Class CovariantBridges
EK9 lets an override narrow its return type (make() <- rtn as Circle over a parent's <- rtn as Shape),
and the object decides which method runs, never the reference or the return type. A JVM method's identity includes
its return type, so without a bridge a call through the parent's type never reaches the override: the parent's
body ran silently, or an abstract parent failed with AbstractMethodError. Each operation records the parent return
types it narrows (OperationInstr.getBridgeReturnTypes()), computed here from the symbols by THE
OverriddenDeclarations - the same lookup phase 3's override rule uses - so no back end re-derives it from
the symbol table at code-generation time (which incremental builds could not see).
Idempotent: recomputed from the symbols each time. A method is looked at only if it is an override; a function only
for its _call.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidannotate(IRConstruct construct) Record the narrowed return types on every operation of the construct.static voidRecord the narrowed return types on every operation of every construct of the module.
-
Method Details
-
annotate
Record the narrowed return types on every operation of every construct of the module. -
annotate
Record the narrowed return types on every operation of the construct.
-