Fix merged polymorphic this reference analysis#4696
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes runaway type instantiation when analyzing polymorphic this in merged class/interface declarations while preserving conservative recursive-reference handling.
Changes:
- Selects the merged declaration containing the analyzed node.
- Adds regression tests for merged
thisand finite recursive nesting. - Adds expected diagnostic baselines for recursive incompatibilities.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/checker/checker.go |
Refines type-parameter reference analysis. |
testdata/tests/cases/compiler/mergedPolymorphicThisReferences.ts |
Tests merged polymorphic this. |
testdata/tests/cases/compiler/selfReferentialInstanceMemberRecursion.ts |
Covers the performance regression. |
testdata/tests/cases/compiler/selfReferencePreservesFiniteNesting.ts |
Tests recursive nesting. |
testdata/tests/cases/compiler/selfReferenceInMethodBody.ts |
Tests references inside methods. |
testdata/tests/cases/compiler/selfReferenceExactInstancesPreserveFiniteNesting.ts |
Tests exact recursive instances. |
testdata/tests/cases/compiler/typePredicateRecursionPreservesFiniteNesting.ts |
Tests recursive type predicates. |
testdata/baselines/reference/compiler/selfReferencePreservesFiniteNesting.errors.txt |
Records expected diagnostics. |
testdata/baselines/reference/compiler/selfReferenceInMethodBody.errors.txt |
Records expected diagnostics. |
testdata/baselines/reference/compiler/selfReferenceExactInstancesPreserveFiniteNesting.errors.txt |
Records expected diagnostics. |
testdata/baselines/reference/compiler/typePredicateRecursionPreservesFiniteNesting.errors.txt |
Records expected diagnostics. |
570c314 to
68ae0a2
Compare
|
@MatthewHarrigan please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Summary
thishas multiple declarations.thisand genuine recursive-reference cases.Performance
On the minimized reproduction:
Validation
npx hereby buildnpx hereby testnpx hereby formatnpx hereby lintAI assistance
This patch was developed with assistance from OpenAI Codex. I have reviewed and understand the changes and will shepherd the review.