Skip to content

Restore idempotency to resolveObjectTypeMembers - #64372

Open
Anders Hejlsberg (ahejlsberg) wants to merge 9 commits into
mainfrom
fix-62180
Open

Anders Hejlsberg (ahejlsberg) wants to merge 9 commits into
mainfrom
fix-62180

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

With this PR we restore idempotent behavior to resolveObjectTypeMembers as was originally intended. In #20400 we allowed type arguments to base types of a class or interface to observe the partially resolved set of members of that class or interface. This ends up being a source of ghost errors as for example observed in #62180. We really shouldn't do this and I think it is perfectly acceptable to disallow base class type arguments from eagerly obtaining the resolved set of members of the class or interface being declared.

Fixes #62180.

@ahejlsberg

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Sep 21, 2026

Copy link
Copy Markdown

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

Command Status Results
test top400 ✅ Started
user test this ✅ Started
run dt ❌ Error: Error: TF215106: Access denied. typescriptbot-github3 needs Queue builds permissions for build pipeline 79:TypeScript PR DT Tests in team project TypeScript to perform the action. For more information, contact the Azure DevOps administrator.
perf test this faster ✅ Started 👀 Results

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.

Copilot review overview

🟡 Changes recommended

Renumbering FromTypeNode breaks the exported ObjectFlags contract and generated enum synchronization.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Restores idempotent object-member resolution and prevents partially resolved members from causing ghost diagnostics.

Changes:

  • Delays publishing structured members until resolution completes.
  • Removes unresolved-member cache state.
  • Adds regression coverage and updates affected baselines.
File Description
tsc/​internal/​checker/​checker.go Revises member resolution and caching.
tsc/​internal/​checker/​types.go Removes the unresolved-members flag.
tsc/​internal/​fourslash/​tests/​noGhostErrors_test.go Tests recursive inference without ghost errors.
tsc/​testdata/​baselines/​reference/​compiler/​recursiveTypeInference.types Updates inferred recursive types.
tsc/​testdata/​baselines/​reference/​compiler/​mutuallyRecursiveInference.errors.txt Records new recursion-depth diagnostic.
tsc/​testdata/​baselines/​reference/​compiler/​keyofGenericExtendingClassDoubleLayer.errors.txt Records new recursion-depth diagnostic.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

ObjectFlagsIdenticalBaseTypeExists = 1 << 28 // has a defined cachedEquivalentBaseType member
ObjectFlagsUnresolvedMembers = 1 << 29 // Member resolution in process
ObjectFlagsFromTypeNode = 1 << 30 // Originates in resolution of AST type node
ObjectFlagsFromTypeNode = 1 << 29 // Originates in resolution of AST type node
@jakebailey

Copy link
Copy Markdown
Member

I fixed the DT error (forgot to grant a perm), but note that DT doesn't check 7.0 or 7.1 quite yet.

@typescript-automation

Copy link
Copy Markdown

Anders Hejlsberg (@ahejlsberg)
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 - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,480 115,480 ~ ~ ~ p=1.000 n=12
Types 96,949 96,949 ~ ~ ~ p=1.000 n=12
Memory Used 148,450k (± 0.41%) 149,016k (± 0.54%) ~ 147,047k 150,787k p=0.291 n=12
Memory Allocs 2,271,609 (± 0.01%) 2,269,434 (± 0.00%) -2,175 (- 0.10%) 2,269,214 2,269,755 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.041s (± 4.59%) 0.042s (± 3.64%) ~ 0.039s 0.047s p=0.256 n=12
Bind Time 0.013s (±10.83%) 0.012s (±12.82%) ~ 0.010s 0.018s p=0.254 n=12
Check Time 0.503s (± 0.70%) 0.509s (± 0.78%) +0.007s (+ 1.31%) 0.502s 0.521s p=0.011 n=12
Emit Time 0.273s (± 2.17%) 0.270s (± 2.05%) ~ 0.253s 0.283s p=0.944 n=12
Total Time 0.836s (± 0.66%) 0.840s (± 0.69%) ~ 0.829s 0.860s p=0.172 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 847,386 (± 0.10%) 846,885 (± 0.06%) ~ 845,477 848,037 p=0.068 n=12
Types 250,003 (± 0.00%) 250,003 (± 0.00%) ~ 250,001 250,013 p=0.755 n=12
Memory Used 793,676k (± 0.05%) 793,498k (± 0.06%) ~ 792,122k 795,266k p=0.478 n=12
Memory Allocs 12,958,810 (± 0.03%) 12,944,638 (± 0.02%) -14,172 (- 0.11%) 12,941,340 12,957,586 p=0.000 n=12
Config Time 0.016s (± 1.13%) 0.016s ~ ~ ~ p=1.000 n=12
Parse Time 0.270s (± 3.14%) 0.273s (± 2.13%) ~ 0.255s 0.291s p=0.434 n=12
Bind Time 0.067s (±15.78%) 0.062s (± 6.49%) ~ 0.059s 0.078s p=0.856 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.636s (± 1.59%) 1.617s (± 1.48%) ~ 1.574s 1.693s p=0.182 n=12
Total Time 2.009s (± 1.61%) 1.985s (± 1.33%) ~ 1.944s 2.067s p=0.117 n=12
mui-docs - native
Errors 11,348 (± 0.02%) 11,347 (± 0.01%) ~ 11,344 11,349 p=0.054 n=12
Symbols 4,305,148 4,305,148 ~ ~ ~ p=1.000 n=12
Types 1,451,831 1,451,831 ~ ~ ~ p=1.000 n=12
Memory Used 4,154,537k (± 0.06%) 4,155,107k (± 0.04%) ~ 4,150,997k 4,158,698k p=0.755 n=12
Memory Allocs 39,225,804 (± 0.05%) 39,169,392 (± 0.03%) -56,413 (- 0.14%) 39,127,355 39,193,834 p=0.000 n=12
Config Time 0.016s (± 1.81%) 0.016s (± 1.98%) ~ 0.015s 0.016s p=1.000 n=12
Parse Time 0.566s (± 1.50%) 0.559s (± 3.35%) ~ 0.482s 0.596s p=1.000 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 15.059s (± 0.15%) 15.024s (± 0.23%) ~ 14.922s 15.096s p=0.103 n=12
Emit Time 0.474s (±11.46%) 0.438s (± 2.77%) ~ 0.425s 0.472s p=0.231 n=12
Total Time 16.882s (± 0.42%) 16.782s (± 0.34%) -0.100s (- 0.59%) 16.635s 16.991s p=0.007 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,394,252 1,394,252 ~ ~ ~ p=1.000 n=12
Types 443,566 443,566 ~ ~ ~ p=1.000 n=12
Memory Used 1,643,473k (± 0.31%) 1,645,781k (± 0.23%) ~ 1,632,510k 1,653,633k p=0.410 n=12
Memory Allocs 96,964,620 (± 0.04%) 96,933,860 (± 0.04%) ~ 96,818,842 97,019,427 p=0.160 n=12
Config Time 0.004s (±11.61%) 0.004s (± 9.48%) ~ 0.003s 0.005s p=1.000 n=12
Parse Time 0.190s (± 3.15%) 0.197s (± 2.34%) +0.007s (+ 3.78%) 0.186s 0.208s p=0.050 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.856s (± 0.29%) 1.856s (± 0.32%) ~ 1.844s 1.874s p=1.000 n=12
Emit Time 0.268s (± 6.29%) 0.279s (± 4.34%) ~ 0.233s 0.301s p=0.370 n=12
Total Time 24.960s (± 0.86%) 25.158s (± 0.80%) ~ 24.503s 25.659s p=0.203 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 337,531 337,531 ~ ~ ~ p=1.000 n=12
Types 198,885 198,885 ~ ~ ~ p=1.000 n=12
Memory Used 319,701k (± 0.07%) 319,566k (± 0.04%) ~ 319,274k 320,087k p=0.291 n=12
Memory Allocs 4,673,007 (± 0.01%) 4,668,940 (± 0.01%) -4,066 (- 0.09%) 4,667,369 4,670,214 p=0.000 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.112s (± 4.82%) 0.111s (± 4.23%) ~ 0.098s 0.123s p=0.877 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.080s (± 0.55%) 1.086s (± 0.49%) ~ 1.070s 1.098s p=0.085 n=12
Emit Time 0.131s (±13.09%) 0.120s (±12.83%) ~ 0.093s 0.159s p=0.401 n=12
Total Time 1.377s (± 1.14%) 1.373s (± 0.94%) ~ 1.345s 1.412s p=0.619 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 305,179 305,179 ~ ~ ~ p=1.000 n=12
Types 181,926 181,926 ~ ~ ~ p=1.000 n=12
Memory Used 277,193k (± 0.03%) 277,127k (± 0.01%) ~ 277,029k 277,267k p=0.193 n=12
Memory Allocs 1,642,050 (± 0.01%) 1,634,541 (± 0.01%) -7,509 (- 0.46%) 1,634,146 1,634,968 p=0.000 n=12
Config Time 0.000s (±217.90%) 0.000s (±217.90%) ~ 0.000s 0.001s p=1.000 n=12
Parse Time 0.099s (± 4.79%) 0.100s (± 3.48%) ~ 0.090s 0.108s p=0.702 n=12
Bind Time 0.036s (±12.47%) 0.039s (±13.84%) ~ 0.028s 0.053s p=0.123 n=12
Check Time 0.848s (± 0.62%) 0.843s (± 0.57%) ~ 0.829s 0.853s p=0.173 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.997s (± 0.94%) 0.996s (± 0.94%) ~ 0.974s 1.017s p=0.744 n=12
vscode - native
Errors 386 386 ~ ~ ~ p=1.000 n=12
Symbols 9,235,564 9,235,564 ~ ~ ~ p=1.000 n=12
Types 3,154,404 3,154,404 ~ ~ ~ p=1.000 n=12
Memory Used 6,165,406k (± 0.02%) 6,165,657k (± 0.02%) ~ 6,163,161k 6,169,642k p=0.671 n=12
Memory Allocs 47,091,555 (± 0.03%) 46,971,469 (± 0.03%) -120,086 (- 0.26%) 46,952,929 47,016,004 p=0.000 n=12
Config Time 0.065s (± 0.28%) 0.065s (± 0.28%) ~ 0.064s 0.065s p=1.000 n=12
Parse Time 1.727s (± 3.01%) 1.712s (± 3.59%) ~ 1.597s 1.871s p=0.630 n=12
Bind Time 0.507s (±20.53%) 0.527s (±21.58%) ~ 0.378s 0.791s p=0.560 n=12
Check Time 11.143s (± 1.33%) 11.134s (± 1.62%) ~ 10.780s 11.455s p=0.787 n=12
Emit Time 4.437s (±11.89%) 4.266s (±12.88%) ~ 3.457s 5.344s p=0.369 n=12
Total Time 17.985s (± 2.43%) 17.815s (± 2.53%) ~ 17.059s 18.699s p=0.219 n=12
webpack - native
Errors 842 843 +1 (+ 0.12%) ~ ~ p=0.000 n=12
Symbols 1,397,420 1,397,446 +26 (+ 0.00%) ~ ~ p=0.000 n=12
Types 605,320 605,325 +5 (+ 0.00%) ~ ~ p=0.000 n=12
Memory Used 968,564k (± 0.01%) 968,473k (± 0.02%) ~ 967,926k 969,090k p=0.551 n=12
Memory Allocs 6,247,584 (± 0.02%) 6,218,984 (± 0.02%) -28,600 (- 0.46%) 6,216,067 6,224,018 p=0.000 n=12
Config Time 0.009s (± 2.77%) 0.009s (± 5.25%) ~ 0.009s 0.011s p=0.137 n=12
Parse Time 0.253s (± 2.94%) 0.269s (± 3.39%) 🔻+0.015s (+ 6.05%) 0.247s 0.300s p=0.010 n=12
Bind Time 0.068s (±19.30%) 0.073s (±16.61%) ~ 0.054s 0.105s p=0.235 n=12
Check Time 1.871s (± 0.40%) 1.911s (± 1.82%) ~ 1.861s 2.010s p=0.075 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 2.237s (± 0.34%) 2.302s (± 1.59%) +0.065s (+ 2.91%) 2.227s 2.424s p=0.000 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,045,695 1,045,695 ~ ~ ~ p=1.000 n=12
Types 383,049 383,049 ~ ~ ~ p=1.000 n=12
Memory Used 611,332k (± 0.01%) 611,319k (± 0.01%) ~ 611,114k 611,563k p=0.990 n=12
Memory Allocs 4,829,565 (± 0.04%) 4,813,490 (± 0.02%) -16,075 (- 0.33%) 4,810,268 4,816,269 p=0.000 n=12
Config Time 0.003s (±11.61%) 0.003s (±12.54%) ~ 0.002s 0.003s p=1.000 n=12
Parse Time 0.150s (± 2.41%) 0.148s (± 4.48%) ~ 0.135s 0.164s p=0.451 n=12
Bind Time 0.038s (±16.55%) 0.047s (±18.09%) 🔻+0.008s (+22.17%) 0.034s 0.070s p=0.019 n=12
Check Time 1.187s (± 0.63%) 1.195s (± 0.85%) ~ 1.172s 1.223s p=0.155 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.388s (± 0.59%) 1.405s (± 0.78%) +0.017s (+ 1.23%) 1.384s 1.443s p=0.025 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@ahejlsberg

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) user test this
TypeScript Bot (@typescript-bot) test top400

@typescript-automation

typescript-automation Bot commented Sep 21, 2026

Copy link
Copy Markdown

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

Command Status Results
user test this ✅ Started ✅ Results
test top400 ✅ Started 👀 Results

@ahejlsberg

Copy link
Copy Markdown
Member Author

Trying tests again...

@typescript-automation

Copy link
Copy Markdown

Anders Hejlsberg (@ahejlsberg) Here are the results of running the user tests with tsc comparing main and refs/pull/64372/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"
  • 1 instance of "Package install failed"

Otherwise...

Everything looks good!

@typescript-automation

Copy link
Copy Markdown

Anders Hejlsberg (@ahejlsberg) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/64372/merge:

Something interesting changed - please have a look.

Details

stablyai/orca

14 of 24 projects failed to build with the old tsc and were ignored

config/tsconfig.cli.json

config/tsconfig.tc.cli.json

config/tsconfig.tc.web.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Confusing missing property error in a circular situation

3 participants