Skip to content

Fix crash on private constructors in intersection base types - #64165

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
Andarist:fix/private-intersection-constructor-accessibility
Sep 4, 2026
Merged

Fix crash on private constructors in intersection base types#64165
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
Andarist:fix/private-intersection-constructor-accessibility

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

Fixes #62614
Recreates #62622

Copilot AI balanced review requested due to automatic review settings September 4, 2026 07:29
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 4, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug labels Sep 4, 2026

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

The focused checker change safely handles all constructor signatures and includes comprehensive regression baselines.

Pull request overview

Prevents crashes when intersection base types include private constructors by checking each constructor’s declaring class.

Changes:

  • Centralizes constructor accessibility checks across extension and instantiation paths.
  • Adds regression and edge-case coverage with diagnostic, type, and symbol baselines.
File summaries
File Description
tsc/internal/checker/checker.go Safely resolves inaccessible constructors.
tsc/testdata/tests/cases/compiler/extendPrivateConstructorClass2.ts Adds compiler regression cases.
tsc/testdata/baselines/reference/compiler/extendPrivateConstructorClass2.errors.txt Records expected diagnostics.
tsc/testdata/baselines/reference/compiler/extendPrivateConstructorClass2.types Records inferred types.
tsc/testdata/baselines/reference/compiler/extendPrivateConstructorClass2.symbols Records symbol resolution.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Sep 4, 2026

Copy link
Copy Markdown

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
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/64165/merge:

There were infrastructure failures potentially unrelated to your change:

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

Otherwise...

Everything looks good!

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Sep 4, 2026
@typescript-automation

Copy link
Copy Markdown

Jake Bailey (@jakebailey)
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,945 96,945 ~ ~ ~ p=1.000 n=12
Memory Used 148,626k (± 0.50%) 148,728k (± 0.56%) ~ 146,974k 150,750k p=0.977 n=12
Memory Allocs 2,271,376 (± 0.00%) 2,271,275 (± 0.00%) -101 (- 0.00%) 2,271,068 2,271,422 p=0.039 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.041s (± 2.59%) 0.041s (± 2.44%) ~ 0.039s 0.044s p=0.839 n=12
Bind Time 0.011s (± 9.56%) 0.013s (±11.85%) ~ 0.010s 0.017s p=0.102 n=12
Check Time 0.495s (± 0.74%) 0.486s (± 0.58%) -0.008s (- 1.68%) 0.481s 0.495s p=0.000 n=12
Emit Time 0.271s (± 1.67%) 0.267s (± 1.55%) ~ 0.257s 0.277s p=0.450 n=12
Total Time 0.824s (± 0.65%) 0.814s (± 0.68%) -0.010s (- 1.25%) 0.800s 0.827s p=0.010 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 847,507 (± 0.10%) 847,074 (± 0.08%) ~ 844,221 848,116 p=0.347 n=12
Types 249,851 (± 0.00%) 249,851 (± 0.00%) ~ 249,849 249,855 p=0.868 n=12
Memory Used 793,285k (± 0.06%) 792,961k (± 0.03%) ~ 792,279k 793,820k p=0.198 n=12
Memory Allocs 12,963,268 (± 0.07%) 12,963,518 (± 0.13%) ~ 12,948,196 13,022,160 p=0.478 n=12
Config Time 0.016s 0.016s ~ ~ ~ p=1.000 n=12
Parse Time 0.274s (± 2.47%) 0.273s (± 2.13%) ~ 0.260s 0.286s p=0.723 n=12
Bind Time 0.064s (±15.77%) 0.060s (± 4.82%) ~ 0.056s 0.073s p=0.844 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.634s (± 0.86%) 1.623s (± 0.54%) ~ 1.606s 1.661s p=0.110 n=12
Total Time 2.004s (± 1.03%) 1.987s (± 0.80%) -0.016s (- 0.80%) 1.964s 2.063s p=0.015 n=12
mui-docs - native
Errors 11,276 (± 0.05%) 11,276 (± 0.03%) ~ 11,263 11,280 p=0.287 n=12
Symbols 4,530,236 4,530,236 ~ ~ ~ p=1.000 n=12
Types 1,524,292 1,524,292 ~ ~ ~ p=1.000 n=12
Memory Used 5,376,413k (± 0.04%) 5,375,487k (± 0.02%) ~ 5,372,750k 5,378,100k p=0.514 n=12
Memory Allocs 46,346,142 (± 0.06%) 46,333,297 (± 0.03%) ~ 46,277,860 46,360,685 p=0.514 n=12
Config Time 0.016s (± 1.81%) 0.016s (± 1.98%) ~ 0.015s 0.016s p=1.000 n=12
Parse Time 0.556s (± 1.28%) 0.558s (± 1.36%) ~ 0.534s 0.574s p=0.966 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 16.119s (± 0.35%) 16.014s (± 0.41%) -0.104s (- 0.65%) 15.898s 16.172s p=0.004 n=12
Emit Time 0.431s (± 0.25%) 0.433s (± 0.30%) +0.002s (+ 0.39%) 0.431s 0.436s p=0.045 n=12
Total Time 17.911s (± 0.66%) 17.747s (± 0.52%) -0.163s (- 0.91%) 17.598s 17.965s p=0.004 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,418 443,418 ~ ~ ~ p=1.000 n=12
Memory Used 1,643,131k (± 0.20%) 1,648,849k (± 0.26%) ~ 1,639,158k 1,661,137k p=0.068 n=12
Memory Allocs 97,017,287 (± 0.03%) 97,070,265 (± 0.05%) ~ 96,955,799 97,159,967 p=0.078 n=12
Config Time 0.004s (±13.98%) 0.004s (±11.15%) ~ 0.003s 0.006s p=0.846 n=12
Parse Time 0.197s (± 3.20%) 0.195s (± 2.60%) ~ 0.182s 0.207s p=0.560 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.812s (± 0.48%) 1.803s (± 0.33%) -0.009s (- 0.49%) 1.781s 1.816s p=0.044 n=12
Emit Time 0.277s (± 5.39%) 0.271s (± 5.54%) ~ 0.241s 0.319s p=0.369 n=12
Total Time 24.850s (± 0.74%) 24.659s (± 0.67%) ~ 24.119s 24.997s p=0.160 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,830 198,830 ~ ~ ~ p=1.000 n=12
Memory Used 319,626k (± 0.07%) 319,558k (± 0.08%) ~ 319,085k 320,749k p=0.671 n=12
Memory Allocs 4,673,031 (± 0.01%) 4,672,871 (± 0.01%) ~ 4,671,427 4,673,658 p=0.630 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.113s (± 3.68%) 0.116s (± 5.25%) ~ 0.102s 0.131s p=0.468 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.053s (± 0.46%) 1.043s (± 0.57%) -0.011s (- 1.01%) 1.026s 1.056s p=0.010 n=12
Emit Time 0.128s (±11.78%) 0.144s (± 9.69%) ~ 0.103s 0.172s p=0.110 n=12
Total Time 1.349s (± 0.67%) 1.355s (± 0.89%) ~ 1.329s 1.402s p=0.370 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,876 181,876 ~ ~ ~ p=1.000 n=12
Memory Used 277,186k (± 0.03%) 277,180k (± 0.02%) ~ 277,024k 277,344k p=0.977 n=12
Memory Allocs 1,641,752 (± 0.01%) 1,641,877 (± 0.01%) ~ 1,641,488 1,642,593 p=0.378 n=12
Config Time 0.000s (±146.91%) 0.000s (±146.91%) ~ 0.000s 0.001s p=1.000 n=12
Parse Time 0.097s (± 4.06%) 0.100s (± 3.83%) ~ 0.089s 0.112s p=0.084 n=12
Bind Time 0.039s (±10.34%) 0.037s (±10.09%) ~ 0.028s 0.049s p=0.339 n=12
Check Time 0.834s (± 0.62%) 0.832s (± 0.54%) ~ 0.823s 0.849s p=0.639 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.984s (± 0.81%) 0.983s (± 0.67%) ~ 0.969s 1.005s p=0.854 n=12
vscode - native
Errors 349 349 ~ ~ ~ p=1.000 n=12
Symbols 8,306,979 8,306,979 ~ ~ ~ p=1.000 n=12
Types 2,849,181 2,849,181 ~ ~ ~ p=1.000 n=12
Memory Used 5,622,155k (± 0.01%) 5,622,322k (± 0.02%) ~ 5,620,524k 5,625,473k p=1.000 n=12
Memory Allocs 43,213,350 (± 0.03%) 43,210,400 (± 0.01%) ~ 43,199,664 43,233,957 p=0.843 n=12
Config Time 0.063s (± 0.39%) 0.064s (± 0.51%) ~ 0.063s 0.064s p=0.089 n=12
Parse Time 1.640s (± 2.71%) 1.655s (± 3.10%) ~ 1.516s 1.761s p=0.723 n=12
Bind Time 0.423s (±14.03%) 0.432s (±19.83%) ~ 0.351s 0.714s p=0.875 n=12
Check Time 10.149s (± 1.51%) 10.198s (± 1.54%) ~ 9.796s 10.393s p=0.319 n=12
Emit Time 3.860s (±12.93%) 3.725s (±13.03%) ~ 3.160s 4.953s p=0.887 n=12
Total Time 16.234s (± 2.28%) 16.169s (± 2.29%) ~ 15.723s 17.196s p=0.876 n=12
webpack - native
Errors 545 545 ~ ~ ~ p=1.000 n=12
Symbols 918,784 918,784 ~ ~ ~ p=1.000 n=12
Types 421,470 421,470 ~ ~ ~ p=1.000 n=12
Memory Used 705,499k (± 0.02%) 705,334k (± 0.03%) ~ 704,864k 705,704k p=0.242 n=12
Memory Allocs 4,582,518 (± 0.04%) 4,581,819 (± 0.02%) ~ 4,579,692 4,585,047 p=0.551 n=12
Config Time 0.008s 0.008s (± 5.88%) ~ 0.008s 0.010s p=0.478 n=12
Parse Time 0.222s (± 1.93%) 0.222s (± 2.28%) ~ 0.210s 0.237s p=0.468 n=12
Bind Time 0.046s (± 8.10%) 0.051s (±14.71%) ~ 0.042s 0.078s p=0.535 n=12
Check Time 1.284s (± 0.80%) 1.286s (± 1.24%) ~ 1.248s 1.346s p=0.876 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.584s (± 0.67%) 1.593s (± 1.43%) ~ 1.563s 1.684s p=0.702 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,022,532 1,022,532 ~ ~ ~ p=1.000 n=12
Types 376,962 376,962 ~ ~ ~ p=1.000 n=12
Memory Used 603,554k (± 0.01%) 603,452k (± 0.01%) -102k (- 0.02%) 603,255k 603,611k p=0.033 n=12
Memory Allocs 4,755,467 (± 0.03%) 4,755,843 (± 0.03%) ~ 4,751,691 4,759,577 p=0.755 n=12
Config Time 0.003s (± 8.64%) 0.003s (±11.61%) ~ 0.002s 0.003s p=0.640 n=12
Parse Time 0.144s (± 3.67%) 0.154s (± 2.26%) 🔻+0.010s (+ 6.64%) 0.143s 0.163s p=0.005 n=12
Bind Time 0.050s (±16.26%) 0.039s (±10.39%) 🟩-0.011s (-22.24%) 0.033s 0.053s p=0.026 n=12
Check Time 1.036s (± 0.59%) 1.045s (± 1.11%) ~ 1.022s 1.084s p=0.213 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.245s (± 0.91%) 1.251s (± 1.20%) ~ 1.224s 1.295s p=0.600 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

@typescript-automation

Copy link
Copy Markdown

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/64165/merge:

Everything looks good!

@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Sep 4, 2026
Merged via the queue into microsoft:main with commit ab6a5a0 Sep 4, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Private constructor in mixin causes "Cannot read properties of undefined (reading 'declarations')"

3 participants