Normalize distributed type parameters during conditional type inference - #64310
Mateusz Burzyński (Andarist) wants to merge 1 commit into
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
| // distributed parameter can be nested in a source (for example, Box<T>). | ||
| // An identity mapper makes instantiateType traverse that source so getMappedType can | ||
| // unwrap each distributed occurrence without otherwise changing the type. | ||
| mapper = newSimpleTypeMapper(nonDistributedTypeParameter, nonDistributedTypeParameter) |
There was a problem hiding this comment.
I'll admit this identity mapper is a little bit of a hack so maybe a better approach can be found for this. That said, this is the boundary level at which the unwrapping should happen established by 9caf8ca
There was a problem hiding this comment.
hm, this might actually not resolve the issue in full for inline types. I'll think about it more
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes conditional-type inference by normalizing distributed type parameters, including nested occurrences.
Changes:
- Normalizes source types before conditional inference.
- Adds direct and nested regression tests.
- Updates generated baselines.
File summaries
| File | Changes |
|---|---|
tsc/testdata/tests/cases/conformance/types/conditional/inferTypes1.ts |
Adds regression cases. |
tsc/testdata/baselines/reference/conformance/inferTypes1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/inferTypes1.symbols |
Updates symbol baseline. |
tsc/testdata/baselines/reference/conformance/inferTypes1.js |
Updates emit baseline. |
tsc/testdata/baselines/reference/conformance/inferTypes1.errors.txt |
Updates diagnostic baseline. |
tsc/internal/checker/inference.go |
Normalizes distributed parameters during inference. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
fixes a regression from #64237 , cc Anders Hejlsberg (@ahejlsberg)