Class AllowOnlyOrError
java.lang.Object
org.ek9lang.compiler.phase5.AllowOnlyOrError
- All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>
final class AllowOnlyOrError
extends Object
implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Enforces 'allow only' constraints on traits and classes (sealed type pattern).
When a trait or class declares 'allow only ClassA, ClassB', only those named classes may extend/implement it. This checker validates that each concrete class is permitted by ALL sealed types it acquires — whether directly declared or transitively inherited through intermediate traits, abstract classes, or super class chains.
Abstract classes are exempt — they cannot be instantiated, so the sealed set controls concrete runtime types only. Dynamic classes are always rejected because their generated names cannot appear in an 'allow only' list.
Uses getAllExtensionConstrainedTraits() to discover all sealed ancestors
(both traits and super classes) in the aggregate's full hierarchy.
-
Constructor Summary
ConstructorsConstructorDescriptionAllowOnlyOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
AllowOnlyOrError
AllowOnlyOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
-