Skip to content

Skip records in the external-spec pass - #370

Merged
CatarinaGamboa merged 1 commit into
mainfrom
fix/record-implicit-members
Oct 8, 2026
Merged

CatarinaGamboa merged 1 commit into
mainfrom
fix/record-implicit-members

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

Fixes #369.

Problem

Since #363 (Spoon 11), any record crashed verification with an NPE in TypeChecker.scan. Spoon 11 dispatches records to visitCtRecord; ExternalRefinementTypeChecker overrides only visitCtClass (to skip user classes), so it walked the record's methods with prefix == null and createReference(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 test passes.

🤖 Generated with Claude Code

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>
@CatarinaGamboa
CatarinaGamboa merged commit 5013598 into main Oct 8, 2026
1 check passed
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.

Regression since the Spoon 11 upgrade: any record crashes the verifier

1 participant