Normalize NoInferred tuple types in rest/spread positions - #4597
Open
Andarist wants to merge 3 commits into
Open
Normalize NoInferred tuple types in rest/spread positions#4597Andarist wants to merge 3 commits into
NoInferred tuple types in rest/spread positions#4597Andarist wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds coverage and a checker-side normalization to ensure NoInfer-wrapped tuple types behave consistently when used in rest/spread positions (addressing microsoft/TypeScript#59668 and #63627).
Changes:
- Normalize
NoInfer<T>when it appears in rest parameters and variadic tuple elements, so tuple spreads are handled predictably. - Add new conformance tests for
NoInferin rest/spread scenarios and commit the corresponding reference baselines.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/checker.go | Adds normalizeNoInferSpread and applies it when computing types for rest parameters and variadic tuple elements. |
| testdata/tests/cases/conformance/types/typeRelationships/typeInference/noInferRestSpread1.ts | New test cases covering contextual typing and error behavior with NoInfer in rest parameters. |
| testdata/tests/cases/conformance/types/typeRelationships/typeInference/noInferRestSpread2.ts | New test cases covering tuple spread/rest normalization for NoInfer (including empty tuple rest). |
| testdata/baselines/reference/conformance/noInferRestSpread1.types | Reference type baseline for the new noInferRestSpread1 test. |
| testdata/baselines/reference/conformance/noInferRestSpread1.symbols | Reference symbols baseline for the new noInferRestSpread1 test. |
| testdata/baselines/reference/conformance/noInferRestSpread1.errors.txt | Reference error baseline for the expected failure in noInferRestSpread1. |
| testdata/baselines/reference/conformance/noInferRestSpread2.types | Reference type baseline for the new noInferRestSpread2 test. |
| testdata/baselines/reference/conformance/noInferRestSpread2.symbols | Reference symbols baseline for the new noInferRestSpread2 test. |
Comment on lines
+23279
to
+23282
| return c.mapType(t.AsSubstitutionType().baseType, func(element *Type) *Type { | ||
| if !isTupleType(element) { | ||
| return c.getNoInferType(t) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes microsoft/TypeScript#59668
fixes microsoft/TypeScript#63627