Open enums (Strategy B): per-case method overrides, hierarchical subt…#653
Open
eliotmoss wants to merge 1 commit into
Open
Open enums (Strategy B): per-case method overrides, hierarchical subt…#653eliotmoss wants to merge 1 commit into
eliotmoss wants to merge 1 commit into
Conversation
…ypes, fields, methods
Squashed snapshot of open_enums3b past master. Adds:
- Open enum types with hierarchical subtypes (`enum E.More { ... }`),
`case _` defaults, DFS-assigned tag ranges for subtype matching,
and qualified case access (`E.More.C`).
- Per-case enum method overrides (`Case { def m() ... }`) via
synthetic per-case VstClass / IrClass / RaClass — Strategy B.
Cases without overrides share the parent RaClass (elision).
- Subtype enum method overrides (`enum E.More { ...; def m() ... }`)
with virtual dispatch through the root enum's mtable.
- Subtype field redeclaration / addition (`E.S(super, f: float)`,
`E.S(super)`, `E.S { D(15) }`) with multi-level inheritance.
- `EnumSetType` for hierarchies (one set type per root, bit positions
by DFS tag).
- Enum method closures with proper boxing on JVM (Integer) and
wasm-gc (i31ref); Oop/raw tag receiver convention switched per
target via NormConfig.
- Queue-based two-dimensional liveness (live cases x live virtuals -> live
impls) and `-compact-mtable=N` optimization for compacting redundant
mtable rows via tag->slot indirection.
- JvmV3EnumGen M_ABSTRACT guard, SsaInliner enum NullCheck skip,
and other backend fixes for v3i / x86 / x86-64 / jar / wasm /
wasm-gc.
- One master regression fix (lookupEnumExprMember VstField receiver),
benchmarks (EnumScalability, EnumLiveness, EnumOverrides,
EnumClosureBoxing), and the wasm bench runner.
- Tutorial and grammar reference updates for open enums.
37/37 ci/Makefile configs pass 3809/3809 tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
…ypes, fields, methods, squahed
Squashed snapshot of open_enums3b past master. Adds:
enum E.More { ... }),case _defaults, DFS-assigned tag ranges for subtype matching, and qualified case access (E.More.C).Case { def m() ... }) via synthetic per-case VstClass / IrClass / RaClass — Strategy B. Cases without overrides share the parent RaClass (elision).enum E.More { ...; def m() ... }) with virtual dispatch through the root enum's mtable.E.S(super, f: float),E.S(super),E.S { D(15) }) with multi-level inheritance.EnumSetTypefor hierarchies (one set type per root, bit positions by DFS tag).-compact-mtable=Noptimization for compacting redundant mtable rows via tag->slot indirection.37/37 ci/Makefile configs pass 3809/3809 tests.