Record Class ConstrainedTypeShape

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.ConstrainedTypeShape
Record Components:
constrainedType - the constrained type itself (DrivingAge); the wrapping constructors are called on it
constrainedTypeName - its IR name
baseType - the constraining (base) type (Integer). The delegation bodies call the BASE type's operators, so their call metadata is read off the base operator - never off the cloned operator on the constrained type, which describes a different (wrapper) body
baseTypeName - its IR name
constraint - the declared constrain as expression, or null when there is none. The check (a Panic on a breach) is emitted into every constructor and mutating operator

record ConstrainedTypeShape(AggregateSymbol constrainedType, String constrainedTypeName, IAggregateSymbol baseType, String baseTypeName, EK9Parser.ConstrainTypeContext constraint) extends Record
THE description of the constrained type being generated, built once per type by ConstrainedTypeDfnGenerator and read by its three parts (ConstraintLowering, ConstrainedConstruction, ConstrainedDelegation) - never mutable per-type state on a generator.
  • Constructor Details

  • Method Details

    • baseIsEnum

      boolean baseIsEnum()
      Whether the base type is an enumeration. An enum's #^ promotes to its String form (not to the base enum), so for an enum base #^ is an ordinary delegation, whereas for every other base #^ returns a copy of the base delegate; an enum base's iterator(), #< and #> range over the constrained SUBSET.
    • hasConstraint

      boolean hasConstraint()
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • constrainedType

      public AggregateSymbol constrainedType()
      Returns the value of the constrainedType record component.
      Returns:
      the value of the constrainedType record component
    • constrainedTypeName

      public String constrainedTypeName()
      Returns the value of the constrainedTypeName record component.
      Returns:
      the value of the constrainedTypeName record component
    • baseType

      public IAggregateSymbol baseType()
      Returns the value of the baseType record component.
      Returns:
      the value of the baseType record component
    • baseTypeName

      public String baseTypeName()
      Returns the value of the baseTypeName record component.
      Returns:
      the value of the baseTypeName record component
    • constraint

      public EK9Parser.ConstrainTypeContext constraint()
      Returns the value of the constraint record component.
      Returns:
      the value of the constraint record component