Skip to content

[claude-experiments] Add subtyping verification test probes#68

Open
jesyspa wants to merge 2 commits intomainfrom
claude/investigate-subtyping
Open

[claude-experiments] Add subtyping verification test probes#68
jesyspa wants to merge 2 commits intomainfrom
claude/investigate-subtyping

Conversation

@jesyspa
Copy link
Copy Markdown
Collaborator

@jesyspa jesyspa commented Mar 12, 2026

Summary

  • Add 6 verification-level tests for subtyping in testData/diagnostics/verification/subtyping/
  • Tests cover: class hierarchy field access, smart casts between class types (including nested), interface subtyping, abstract classes, safe cast/upcast, and method override dispatch
  • All tests verify cleanly individually

Test details

Test What it covers
class_hierarchy_basics.kt Inherited field access, passing subtype where supertype expected
smart_cast_class.kt Smart casts from Shape→Rectangle→Square, nested is-checks
interface_verification.kt Interface property access, Person is HasName
abstract_class.kt Abstract class subtype relationships
cast_verification.kt as? safe cast, upcast always succeeds
override_methods.kt Override method calls, static dispatch through supertype reference

Known issue

These tests exhibit inter-test state contamination when run as a batch (--tests "*Subtyping*"), but pass when run individually. This appears to be a test infrastructure issue, not a verification problem.

Test plan

  • Each test passes individually on second run (golden file generation + verification)
  • Confirm no regressions in existing test suite

🤖 Generated with Claude Code

jesyspa and others added 2 commits March 12, 2026 13:17
Add 6 verification-level tests covering:
- Basic class hierarchy field access and subtype passing
- Smart casts between class types (including nested)
- Interface property access and subtype verification
- Abstract class subtyping
- Safe cast and upcast verification
- Method override dispatch behavior

These tests all verify cleanly individually. Note: they exhibit
inter-test state contamination when run as a batch, which is a
test infrastructure issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 4 tests probing how shared/unique predicates interact with casts:
- permissions_cast.kt: field access after as/as?/smart casts (passes)
- permissions_unique.kt: mutable field access with shared params (havoc)
- permissions_double_predicate.kt: double predicate inhaling (passes)
- permissions_unique_subtype.kt: @unique subtype → @unique supertype
  FINDING: fails with "insufficient permission to access MutBox$unique"
  because ExtMutBox$unique isn't unfolded to extract MutBox$unique

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jesyspa jesyspa changed the title Add subtyping verification test probes [claude-experiments] Add subtyping verification test probes Apr 4, 2026
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.

1 participant