Skip to content

Normalize distributed type parameters during conditional type inference - #64310

Draft
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:distributed-conditional-type-followups
Draft

Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:distributed-conditional-type-followups

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes a regression from #64237 , cc Anders Hejlsberg (@ahejlsberg)

Copilot AI balanced review requested due to automatic review settings September 17, 2026 15:34
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 17, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 17, 2026
@typescript-automation

Copy link
Copy Markdown

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, this might actually not resolve the issue in full for inline types. I'll think about it more

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@Andarist
Mateusz Burzyński (Andarist) marked this pull request as draft September 17, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants