Skip to content

Conversation

Andarist
Copy link
Contributor

fixes #62345

@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 21:57
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Aug 27, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Aug 27, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the proper propagation of ObjectFlags.NonInferrableType onto non-aliased anonymous object type instantiations, addressing issue #62345. The fix ensures that when instantiating generic types, certain object flags (including NonInferrableType) are properly carried forward from the type arguments to the resulting instantiated type.

  • Extracts propagating flags from type arguments before computing type variable containment
  • Applies all propagating flags (including NonInferrableType) to the result object type
  • Adds comprehensive test coverage for various scenarios where non-inferrable type propagation should occur

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/cases/compiler/nonInferrableTypePropagation4.ts Adds test cases covering object types, type aliases, arrays, and nested structures
tests/baselines/reference/nonInferrableTypePropagation4.types Expected type inference baseline showing unknown types in results
tests/baselines/reference/nonInferrableTypePropagation4.symbols Expected symbol resolution baseline for the test
tests/baselines/reference/nonInferrableTypePropagation4.errors.txt Expected compilation errors showing type assignment failures
src/compiler/checker.ts Core fix in type instantiation logic to propagate object flags properly

else {
(result as ObjectFlagsType).objectFlags |= !resultCouldContainTypeVariables ? ObjectFlags.CouldContainTypeVariablesComputed : 0;
if (result.flags & TypeFlags.ObjectFlagsType) {
let propagatingFlags = getPropagatingFlagsOfTypes(typeArguments);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Propagating from typeArguments is the core of the fix, the rest is just adjusted indentation.

You can also find some prior related discussion here: #49887 (comment)

@RyanCavanaugh
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 27, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

Hey @RyanCavanaugh, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@RyanCavanaugh Here are the results of running the user tests with tsc comparing main and refs/pull/62346/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@RyanCavanaugh
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,370 62,370 ~ ~ ~ p=1.000 n=6
Types 50,386 50,386 ~ ~ ~ p=1.000 n=6
Memory used 194,110k (± 0.96%) 194,609k (± 0.95%) ~ 192,918k 196,534k p=0.378 n=6
Parse Time 1.30s (± 0.75%) 1.31s (± 0.31%) ~ 1.31s 1.32s p=0.056 n=6
Bind Time 0.73s (± 0.56%) 0.73s (± 0.56%) ~ 0.72s 0.73s p=1.000 n=6
Check Time 9.76s (± 0.19%) 9.76s (± 0.50%) ~ 9.71s 9.84s p=1.000 n=6
Emit Time 2.73s (± 0.80%) 2.75s (± 1.38%) ~ 2.70s 2.80s p=0.291 n=6
Total Time 14.52s (± 0.20%) 14.55s (± 0.47%) ~ 14.47s 14.67s p=0.332 n=6
angular-1 - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 948,914 948,914 ~ ~ ~ p=1.000 n=6
Types 410,884 410,884 ~ ~ ~ p=1.000 n=6
Memory used 1,246,608k (± 0.00%) 1,246,637k (± 0.00%) ~ 1,246,581k 1,246,682k p=0.298 n=6
Parse Time 6.53s (± 0.99%) 6.51s (± 0.91%) ~ 6.47s 6.63s p=0.466 n=6
Bind Time 1.87s (± 0.59%) 1.87s (± 0.62%) ~ 1.85s 1.88s p=0.729 n=6
Check Time 32.24s (± 0.31%) 32.24s (± 0.31%) ~ 32.14s 32.41s p=1.000 n=6
Emit Time 14.79s (± 0.36%) 14.78s (± 0.50%) ~ 14.71s 14.91s p=0.517 n=6
Total Time 55.43s (± 0.22%) 55.40s (± 0.23%) ~ 55.24s 55.51s p=0.936 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,545,948 2,545,948 ~ ~ ~ p=1.000 n=6
Types 902,562 902,562 ~ ~ ~ p=1.000 n=6
Memory used 2,830,891k (± 0.01%) 2,830,788k (± 0.00%) ~ 2,830,718k 2,830,954k p=0.093 n=6
Parse Time 8.76s (± 0.36%) 8.77s (± 0.20%) ~ 8.75s 8.80s p=0.683 n=6
Bind Time 2.23s (± 0.72%) 2.23s (± 0.73%) ~ 2.21s 2.25s p=0.934 n=6
Check Time 86.50s (± 1.67%) 87.77s (± 0.93%) ~ 86.38s 88.66s p=0.066 n=6
Emit Time 0.62s (±124.07%) 0.36s (±39.04%) ~ 0.30s 0.65s p=1.000 n=6
Total Time 98.10s (± 1.61%) 99.13s (± 0.80%) ~ 97.70s 99.98s p=0.230 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,922 1,236,923 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,638 259,638 ~ ~ ~ p=1.000 n=6
Memory used 2,507,831k (±11.82%) 2,447,319k (± 6.06%) ~ 2,386,546k 2,750,149k p=0.810 n=6
Parse Time 5.22s (± 1.30%) 5.19s (± 1.05%) ~ 5.13s 5.28s p=0.748 n=6
Bind Time 1.81s (± 0.45%) 1.80s (± 1.26%) ~ 1.75s 1.81s p=0.491 n=6
Check Time 35.17s (± 0.52%) 34.97s (± 0.42%) ~ 34.70s 35.11s p=0.066 n=6
Emit Time 3.01s (± 2.54%) 2.98s (± 1.23%) ~ 2.93s 3.02s p=0.521 n=6
Total Time 45.21s (± 0.46%) 44.96s (± 0.33%) ~ 44.79s 45.12s p=0.066 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,236,922 1,236,923 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 259,638 259,638 ~ ~ ~ p=1.000 n=6
Memory used 2,818,872k (±14.05%) 2,940,056k (±12.71%) ~ 2,457,031k 3,182,171k p=0.230 n=6
Parse Time 6.86s (± 1.08%) 6.86s (± 1.78%) ~ 6.69s 6.96s p=1.000 n=6
Bind Time 2.19s (± 1.57%) 2.19s (± 1.29%) ~ 2.16s 2.24s p=0.810 n=6
Check Time 42.48s (± 0.56%) 42.40s (± 0.47%) ~ 42.16s 42.70s p=0.521 n=6
Emit Time 3.59s (± 4.83%) 3.48s (± 0.48%) ~ 3.46s 3.50s p=0.470 n=6
Total Time 55.11s (± 0.62%) 54.94s (± 0.50%) ~ 54.58s 55.27s p=0.298 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,416 262,417 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 103,917 103,917 ~ ~ ~ p=1.000 n=6
Memory used 441,719k (± 0.02%) 441,676k (± 0.02%) ~ 441,605k 441,776k p=0.378 n=6
Parse Time 4.40s (± 0.87%) 4.39s (± 0.84%) ~ 4.33s 4.42s p=0.568 n=6
Bind Time 1.64s (± 1.21%) 1.63s (± 0.72%) ~ 1.62s 1.65s p=0.506 n=6
Check Time 23.39s (± 0.48%) 23.43s (± 0.16%) ~ 23.38s 23.49s p=0.521 n=6
Emit Time 1.90s (± 0.86%) 1.90s (± 0.72%) ~ 1.89s 1.92s p=0.564 n=6
Total Time 31.33s (± 0.39%) 31.35s (± 0.08%) ~ 31.31s 31.37s p=0.374 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 72 72 ~ ~ ~ p=1.000 n=6
Symbols 225,367 225,367 ~ ~ ~ p=1.000 n=6
Types 94,290 94,290 ~ ~ ~ p=1.000 n=6
Memory used 371,153k (± 0.03%) 371,212k (± 0.03%) ~ 371,103k 371,454k p=0.093 n=6
Parse Time 2.88s (± 1.31%) 2.87s (± 0.84%) ~ 2.85s 2.92s p=0.628 n=6
Bind Time 1.57s (± 1.04%) 1.59s (± 0.66%) ~ 1.58s 1.61s p=0.061 n=6
Check Time 16.45s (± 0.38%) 16.46s (± 0.40%) ~ 16.38s 16.54s p=0.809 n=6
Emit Time 0.00s (±154.76%) 0.00s ~ ~ ~ p=0.174 n=6
Total Time 20.91s (± 0.38%) 20.93s (± 0.41%) ~ 20.83s 21.07s p=0.873 n=6
vscode - node (v18.15.0, x64)
Errors 1 1 ~ ~ ~ p=1.000 n=6
Symbols 3,874,623 3,874,623 ~ ~ ~ p=1.000 n=6
Types 1,221,094 1,221,094 ~ ~ ~ p=1.000 n=6
Memory used 3,701,589k (± 0.01%) 3,701,741k (± 0.01%) ~ 3,701,252k 3,702,002k p=0.471 n=6
Parse Time 18.79s (± 0.50%) 18.75s (± 0.35%) ~ 18.66s 18.84s p=0.809 n=6
Bind Time 6.22s (± 2.84%) 6.10s (± 1.67%) ~ 6.03s 6.30s p=0.260 n=6
Check Time 126.11s (± 2.87%) 127.00s (± 4.03%) ~ 122.01s 133.41s p=0.936 n=6
Emit Time 44.65s (±22.78%) 44.96s (±19.89%) ~ 37.34s 55.73s p=0.810 n=6
Total Time 195.76s (± 6.85%) 196.81s (± 4.42%) ~ 184.69s 205.25s p=0.689 n=6
webpack - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 356,094 356,094 ~ ~ ~ p=1.000 n=6
Types 156,860 156,860 ~ ~ ~ p=1.000 n=6
Memory used 513,209k (± 0.04%) 513,205k (± 0.04%) ~ 512,919k 513,373k p=0.689 n=6
Parse Time 4.60s (± 0.41%) 4.60s (± 0.70%) ~ 4.57s 4.66s p=1.000 n=6
Bind Time 1.90s (± 0.52%) 1.91s (± 0.97%) ~ 1.88s 1.93s p=0.118 n=6
Check Time 22.05s (± 0.82%) 21.92s (± 0.54%) ~ 21.80s 22.13s p=0.230 n=6
Emit Time 0.00s (±244.70%) 0.00s (±244.70%) ~ 0.00s 0.01s p=1.000 n=6
Total Time 28.55s (± 0.69%) 28.44s (± 0.31%) ~ 28.35s 28.59s p=0.378 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 36 🔻+6 (+20.00%) ~ ~ p=0.001 n=6
Symbols 666,064 665,668 -396 (- 0.06%) ~ ~ p=0.001 n=6
Types 199,729 199,550 -179 (- 0.09%) ~ ~ p=0.001 n=6
Memory used 572,484k (± 0.03%) 572,249k (± 0.02%) ~ 572,027k 572,378k p=0.065 n=6
Parse Time 5.29s (± 0.44%) 5.33s (± 1.21%) ~ 5.22s 5.42s p=0.091 n=6
Bind Time 1.65s (± 0.91%) 1.65s (± 0.62%) ~ 1.64s 1.67s p=0.867 n=6
Check Time 25.27s (± 1.98%) 24.87s (± 1.12%) ~ 24.68s 25.43s p=0.229 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 32.21s (± 1.50%) 31.85s (± 0.94%) ~ 31.66s 32.45s p=0.199 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@RyanCavanaugh Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62346/merge:

Everything looks good!

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.

silentNeverType leak in contextual parameter types coming from anonymous non-aliased object type instantiations
3 participants