Record Class DispatchFacts

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.calls.DispatchFacts
Record Components:
targetTypeName - the type the CALL names - the type whose member is called
isTraitCall - that type compiles to an interface (a trait or Any) - TraitCall
isVirtualCall - the call dispatches on the receiver's runtime type
isExternTarget - the named type is externally linked: EXTERN or PRE_BUILT (Java on the JVM, C natively); a user type, or a compiler-generated member of one, is NOT

public record DispatchFacts(String targetTypeName, boolean isTraitCall, boolean isVirtualCall, boolean isExternTarget) extends Record
THE dispatch facts of a CALL - the four CallDetails fields that say WHERE the call goes and HOW it gets there: the type it names (targetTypeName), whether that type is an interface (isTraitCall), whether the call dispatches through the vtable (isVirtualCall) and whether the named type is externally linked (isExternTarget - EXTERN or PRE_BUILT, see IsExternallyLinked; Steve 2026-10-28). Use this - do not derive the four flags again at a new call site.

Each route that builds a CallDetails from a resolved symbol derives these facts here, by a NAMED factory that states its rule, so the rules sit side by side and a difference between two of them is visible in one file rather than in six (IR tidy plan MONO-6 (b)). CallDetailsFactory.resolvedCall turns the facts into the record; a route that keeps a literal new CallDetails( is one still to migrate (W4.4).

The factories are a pure extraction: each gives exactly the answer its route gave before it moved here. Where two routes answer the same question differently, that difference is recorded on the factory and left as it is, because changing it moves goldens and is a wave-4 decision:

The JVM back end reads targetTypeName, isTraitCall and the explicit-trait-default flag; it ignores isVirtualCall and isExternTarget, so a change to either must be named for the LLVM branch. CallDetails.toString() renders virtual= and trait= but never isExternTarget (IR tidy plan section 9.1).

  • Constructor Summary

    Constructors
    Constructor
    Description
    DispatchFacts(String targetTypeName, boolean isTraitCall, boolean isVirtualCall, boolean isExternTarget)
    Creates an instance of a DispatchFacts record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the isExternTarget record component.
    boolean
    Returns the value of the isTraitCall record component.
    boolean
    Returns the value of the isVirtualCall record component.
    (package private) static DispatchFacts
    ofClose(String ownerTypeName, boolean isTraitCall, boolean isVirtualCall, ISymbol ownerType)
    The facts of a generated close - see CloseCallTarget, which decides them.
    ofForwardToBase(String definingTypeName, ISymbol definingType, ISymbol baseType)
    The facts of a call a constrained type FORWARDS to its base (a delegated member, a constraint comparison): the call names the type that DECLARES the base member and the trait flag is read off that same type, dispatch is the BASE type's openness, and extern is the declaring type's (IsExternallyLinked).
    ofOperatorFallback(Optional<ScopedSymbol> servingMember, ISymbol staticType, boolean explicitSuperReceiver, TypeNameOrException typeNames, UnaryOperator<ISymbol> concreteType)
    The facts of an operator call with no parse node (path B of CallDetailsBuilder: a compound assignment, a unary operator, a phase-7 protocol call): the call names the type that declares the serving member when one resolves, else the static type; a trait call is virtual by definition, otherwise dispatch is the static type's openness; extern is the STATIC type's (MONO-5 - see the class note).
    ofResolvedCall(ISymbol resolvedMethod, ISymbol servingMethod, ISymbol staticType, boolean explicitSuperReceiver, TypeNameOrException typeNames, UnaryOperator<ISymbol> concreteType)
    The facts of a call to a member phase 3 RESOLVED (path A of CallDetailsBuilder): the call names the type that DECLARES the serving member, the trait flag is read off that same type (they move together - CallTargetResolution), dispatch is IsVirtualCall of the RECORDED member and the static type, and extern is the declaring type's.
    ofSynthesisedCallee(String targetTypeName, boolean isTraitCall, ISymbol calleeType, UnaryOperator<ISymbol> concreteType)
    The facts of a call the compiler SYNTHESISED on a value's type (?, close): the named type and its trait flag as given, dispatch from the callee type's openness (IsVirtualForSynthesisedCallee), extern the callee type's (IsExternallyLinked).
    ofTargetType(String targetTypeName, ISymbol targetType, boolean shapePermitsDispatch)
    The facts of a call on a type held as a SYMBOL but with no resolved member (CallDetailsFactory.call's symbol overload): the call names that type, the trait flag and openness are read off it, the call SHAPE may veto dispatch, and extern is the named type's (IsExternallyLinked).
    Returns the value of the targetTypeName record component.
    final String
    Returns a string representation of this record class.
    These facts for the same member reached through super: the named type is kept, and the call is neither an interface call nor dispatched - it runs exactly that type's body.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DispatchFacts

      public DispatchFacts(String targetTypeName, boolean isTraitCall, boolean isVirtualCall, boolean isExternTarget)
      Creates an instance of a DispatchFacts record class.
      Parameters:
      targetTypeName - the value for the targetTypeName record component
      isTraitCall - the value for the isTraitCall record component
      isVirtualCall - the value for the isVirtualCall record component
      isExternTarget - the value for the isExternTarget record component
  • Method Details

    • ofResolvedCall

      public static DispatchFacts ofResolvedCall(ISymbol resolvedMethod, ISymbol servingMethod, ISymbol staticType, boolean explicitSuperReceiver, TypeNameOrException typeNames, UnaryOperator<ISymbol> concreteType)
      The facts of a call to a member phase 3 RESOLVED (path A of CallDetailsBuilder): the call names the type that DECLARES the serving member, the trait flag is read off that same type (they move together - CallTargetResolution), dispatch is IsVirtualCall of the RECORDED member and the static type, and extern is the declaring type's.
      Parameters:
      resolvedMethod - the member phase 3 recorded (it decides dispatch)
      servingMethod - the member that serves the call - the type argument's own inside a monomorphisation (OperatorTargetMethodResolver.onTypeArgument), else resolvedMethod
      staticType - the receiver's static type (or a value symbol, resolved to its type here)
      explicitSuperReceiver - the call is made on super, which never dispatches
      typeNames - THE resolver-aware type namer of the generation in progress
      concreteType - the generation's symbol resolver (IRGenerationContext::resolveType): inside a monomorphised body a bare T is the type argument, whose linkage is asked
    • ofOperatorFallback

      public static DispatchFacts ofOperatorFallback(Optional<ScopedSymbol> servingMember, ISymbol staticType, boolean explicitSuperReceiver, TypeNameOrException typeNames, UnaryOperator<ISymbol> concreteType)
      The facts of an operator call with no parse node (path B of CallDetailsBuilder: a compound assignment, a unary operator, a phase-7 protocol call): the call names the type that declares the serving member when one resolves, else the static type; a trait call is virtual by definition, otherwise dispatch is the static type's openness; extern is the STATIC type's (MONO-5 - see the class note).
      Parameters:
      servingMember - the member that serves the call, when one resolves on the static type
      staticType - the receiver's static type (or a value symbol, resolved to its type here)
      explicitSuperReceiver - the call is made on super, which never dispatches
      typeNames - THE resolver-aware type namer of the generation in progress
      concreteType - the generation's symbol resolver (IRGenerationContext::resolveType): inside a monomorphised body a bare T is the type argument, whose linkage is asked
    • ofTargetType

      public static DispatchFacts ofTargetType(String targetTypeName, ISymbol targetType, boolean shapePermitsDispatch)
      The facts of a call on a type held as a SYMBOL but with no resolved member (CallDetailsFactory.call's symbol overload): the call names that type, the trait flag and openness are read off it, the call SHAPE may veto dispatch, and extern is the named type's (IsExternallyLinked).
      Parameters:
      targetTypeName - the IR name of that type
      targetType - the type that defines the method
      shapePermitsDispatch - false for a lifecycle method or an explicit super call
    • ofForwardToBase

      public static DispatchFacts ofForwardToBase(String definingTypeName, ISymbol definingType, ISymbol baseType)
      The facts of a call a constrained type FORWARDS to its base (a delegated member, a constraint comparison): the call names the type that DECLARES the base member and the trait flag is read off that same type, dispatch is the BASE type's openness, and extern is the declaring type's (IsExternallyLinked).
      Parameters:
      definingTypeName - the IR name of the declaring type
      definingType - the type that declares the base member (DefiningType)
      baseType - the constrained type's base, whose openness decides dispatch
    • ofSynthesisedCallee

      public static DispatchFacts ofSynthesisedCallee(String targetTypeName, boolean isTraitCall, ISymbol calleeType, UnaryOperator<ISymbol> concreteType)
      The facts of a call the compiler SYNTHESISED on a value's type (?, close): the named type and its trait flag as given, dispatch from the callee type's openness (IsVirtualForSynthesisedCallee), extern the callee type's (IsExternallyLinked).
      Parameters:
      targetTypeName - the IR name of the type the call names (keeps any Scenario-3 substitution)
      isTraitCall - that type compiles to an interface
      calleeType - the type whose openness decides dispatch (may be null: not virtual)
      concreteType - the generation's symbol resolver (IRGenerationContext::resolveType)
    • ofClose

      static DispatchFacts ofClose(String ownerTypeName, boolean isTraitCall, boolean isVirtualCall, ISymbol ownerType)
      The facts of a generated close - see CloseCallTarget, which decides them.
      Parameters:
      ownerTypeName - the type that declares close
      isTraitCall - that type compiles to an interface
      isVirtualCall - the value's static type may hold a subtype that overrides close
      ownerType - the type that declares close (decides isExternTarget)
    • viaSuper

      public DispatchFacts viaSuper()
      These facts for the same member reached through super: the named type is kept, and the call is neither an interface call nor dispatched - it runs exactly that type's body.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • targetTypeName

      public String targetTypeName()
      Returns the value of the targetTypeName record component.
      Returns:
      the value of the targetTypeName record component
    • isTraitCall

      public boolean isTraitCall()
      Returns the value of the isTraitCall record component.
      Returns:
      the value of the isTraitCall record component
    • isVirtualCall

      public boolean isVirtualCall()
      Returns the value of the isVirtualCall record component.
      Returns:
      the value of the isVirtualCall record component
    • isExternTarget

      public boolean isExternTarget()
      Returns the value of the isExternTarget record component.
      Returns:
      the value of the isExternTarget record component