Skip to content

Conversation

@ahejlsberg
Copy link
Member

Copy link
Contributor

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 ports a crash fix from TypeScript PR #62928 that prevents a nil pointer dereference in mixin type checking. The fix adds a guard condition in the getBaseTypes function to check if a type has the appropriate object flags before attempting to access its interface type data.

  • Added guard condition to prevent crash when getBaseTypes is called on types without class/interface/reference object flags
  • Added regression test case noCrashOnMixin2.ts that demonstrates the previously crashing mixin pattern
  • Test properly produces type-checking errors without crashing the compiler

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
testdata/tests/cases/compiler/noCrashOnMixin2.ts Adds regression test for mixin crash scenario with protected constructors
testdata/baselines/reference/compiler/noCrashOnMixin2.types Expected type inference output for the test case
testdata/baselines/reference/compiler/noCrashOnMixin2.symbols Expected symbol resolution output for the test case
testdata/baselines/reference/compiler/noCrashOnMixin2.errors.txt Expected error messages showing proper error reporting without crash
internal/checker/checker.go Adds guard condition in getBaseTypes to prevent nil pointer dereference on types without appropriate object flags

@ahejlsberg ahejlsberg enabled auto-merge December 28, 2025 21:13
@ahejlsberg ahejlsberg added this pull request to the merge queue Dec 28, 2025
Merged via the queue into main with commit 1611cc9 Dec 28, 2025
29 checks passed
@ahejlsberg ahejlsberg deleted the port-62928 branch December 28, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants