Class RequiredOperatorPresentOrError

All Implemented Interfaces:
Function<CheckOperatorData, Optional<ISymbol>>

final class RequiredOperatorPresentOrError extends TypedSymbolAccess implements Function<CheckOperatorData, Optional<ISymbol>>
To be used with operators on aggregates (except for the is-set ? operator, that has to deal with functions). This function attempts to locate the method on the aggregate and returns the type of the return variable or empty.
  • Constructor Details

  • Method Details

    • apply

      public Optional<ISymbol> apply(CheckOperatorData checkOperatorData)
      Specified by:
      apply in interface Function<CheckOperatorData, Optional<ISymbol>>
    • apply

      public Optional<ISymbol> apply(CheckOperatorData checkOperatorData, CallSymbol callSymbol)
      Overloaded version that accepts a CallSymbol and sets the resolved method on it. This is used for operator expressions where we need to store the resolved method for later IR generation (particularly for parameter promotion).
    • noteOperatorAccessedIfConceptualType

      static void noteOperatorAccessedIfConceptualType(IAggregateSymbol aggregate, MethodSymbol operator)
      We need to know if an operator has been used when employed in a 'T' in the generic type This is needed later so that when a generic type is parameterised we can check each of the types and see which operators have been accessed, then we can ensure the argument to the parameterization has that operator.

      THE marking of an operator used on a generic's conceptual T: an operator resolved by any other route (a stream terminal's or tee's '|', resolved in StreamAssemblyOrError; a mutating or assignment operator such as ':=:', ':~:' or '+=', resolved in LhsAndRhsAssignmentOrError) calls this too, so phase4/ParameterisedTypeOrError reports a parameterising type that lacks it (E07620) instead of IR generation failing on a compile-clean program.