Module aya.base

Record Class ClassCall

java.lang.Object
java.lang.Record
org.aya.core.term.ClassCall
All Implemented Interfaces:
Formation, StableWHNF, Term, AyaDocile, org.aya.guest0x0.cubical.Restr.TermLike<Term>

public record ClassCall(@NotNull DefVar<ClassDef,ClassDecl> ref, int ulift, @NotNull kala.collection.immutable.ImmutableMap<DefVar<MemberDef,TeleDecl.ClassMember>,org.aya.util.Arg<Term>> args) extends Record implements StableWHNF, Formation
ClassCall is a very special construction in Aya.
  • It is like a type when partially instantiated -- the type of "specifications" of the rest of the fields.
  • It is like a term when fully instantiated, whose type can be anything.
  • It can be applied like a function, which essentially inserts the nearest missing field.
  • Constructor Details

    • ClassCall

      public ClassCall(@NotNull @NotNull DefVar<ClassDef,ClassDecl> ref, int ulift, @NotNull @NotNull kala.collection.immutable.ImmutableMap<DefVar<MemberDef,TeleDecl.ClassMember>,org.aya.util.Arg<Term>> args)
      Creates an instance of a ClassCall record class.
      Parameters:
      ref - the value for the ref record component
      ulift - the value for the ulift record component
      args - the value for the args record component
  • Method Details

    • fieldSubst

      @NotNull public @NotNull Subst fieldSubst(@Nullable @Nullable MemberDef member)
    • missingMembers

      @NotNull public @NotNull kala.collection.SeqView<MemberDef> missingMembers()
    • instantiated

      public boolean instantiated(@NotNull @NotNull MemberDef member)
    • sameApply

      public boolean sameApply(@NotNull @NotNull ClassCall other)
      Returns:
      true if these two calls have same members applied
    • orderedArgs

      @NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.Arg<Term>> orderedArgs()
      must be called after checking sameApply(ClassCall) if the return value is used in comparator.
    • addMember

      @NotNull public @NotNull kala.control.Result<ClassCall,org.aya.util.reporter.Problem> addMember(@NotNull Expr.Field<Expr> member, @NotNull @NotNull ExprTycker tycker)
    • addMember

      @NotNull public @NotNull ClassCall addMember(@NotNull @NotNull ExprTycker tycker, @NotNull @NotNull MemberDef member, Expr expr)
    • update

      @NotNull public @NotNull ClassCall update(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<kala.tuple.Tuple2<DefVar<MemberDef,TeleDecl.ClassMember>,org.aya.util.Arg<Term>>> args)
    • descent

      @NotNull public @NotNull ClassCall descent(@NotNull @NotNull UnaryOperator<@NotNull Term> f, @NotNull @NotNull UnaryOperator<Pat> g)
      Description copied from interface: Term
      Descending an operation to the term AST. NOTE: Currently we require the operation `f` to preserve:
      invalid @link
      StructCall
      , DataCall, SortTerm, Shaped.Applicable.
      Specified by:
      descent in interface Term
    • 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 '=='.
      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.
    • ref

      @NotNull public @NotNull DefVar<ClassDef,ClassDecl> ref()
      Returns the value of the ref record component.
      Returns:
      the value of the ref record component
    • ulift

      public int ulift()
      Returns the value of the ulift record component.
      Returns:
      the value of the ulift record component
    • args

      @NotNull public @NotNull kala.collection.immutable.ImmutableMap<DefVar<MemberDef,TeleDecl.ClassMember>,org.aya.util.Arg<Term>> args()
      Returns the value of the args record component.
      Returns:
      the value of the args record component