Repository navigation
Skip records in the external-spec pass - #370
Merged
Merged
Conversation
Fixes #369. Since the Spoon 11 upgrade, records reach visitCtRecord instead of visitCtClass, so ExternalRefinementTypeChecker visited a record's methods with no external target and crashed. It now skips records as it skips classes. TypeChecker.scan also reports elements without a source file instead of failing on their position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #369.
Problem
Since #363 (Spoon 11), any
recordcrashed verification with an NPE inTypeChecker.scan. Spoon 11 dispatches records tovisitCtRecord;ExternalRefinementTypeCheckeroverrides onlyvisitCtClass(to skip user classes), so it walked the record's methods withprefix == nullandcreateReference(null)threw. Building the error message then failed on the record's implicit members, which have no source file.Change
ExternalRefinementTypeChecker.visitCtRecord: skip, as for classes.TypeChecker.scan: when the failing element has no source file, the message says so instead of throwing an NPE.With this, record methods are verified: a refinement violation inside a record method is reported (related to #342).
Tests
CorrectRecord: a record with a method calling a refined method correctly; crashed on main, now passes.ErrorRecordMethod: a violation in a record method is reported.mvn testpasses.🤖 Generated with Claude Code