Interface ISymTypeRelations


@Deprecated public interface ISymTypeRelations
Deprecated.
use SymTypeRelations
Relations of SymTypeExpressions

some are dependent on the specific type system and as such not hardcoded in the SymTypeExpressions themselves

  • Method Details

    • isCompatible

      boolean isCompatible(SymTypeExpression assignee, SymTypeExpression assigner)
      Deprecated.
      whether the assignee can be assigned to by the assigner, e.g., assignment operator: x = 2, type of x and type of 2 need to be compatible, e.g., functions call: (float -> void)(2), float and type of 2 need to be compatible
    • isSubTypeOf

      boolean isSubTypeOf(SymTypeExpression subType, SymTypeExpression superType)
      Deprecated.
      whether subType is the sub-type of superType, Examples: isSubType(Person, Person) isSubType(Student, Person) !isSubType(Person, Student) isSubType(int, float) !isSubType(float, int)
    • getNominalSuperTypes

      List<SymTypeExpression> getNominalSuperTypes(SymTypeExpression thisType)
      Deprecated.
      returns nominal supertypes. Nominal supertypes are those that are explicitly listed as super types, e.g., in Java those specified using "extends" or "implements". The return value is neither the reflexive nor the transitive closure, i.e., only the direct supertypes are included (s. Java spec 20 4.10). Note that the "direct" supertype-relation is deliberately underspecified, such that it can be refined according to the specific type system's needs.
    • box

      Deprecated.
      Boxes SymTypeExpressions, including, but not limited to, Java primitive boxing e.g., int -> java.lang.Integer e.g., List -> java.util.List
    • unbox

      Deprecated.
      Unboxes SymTypeExpressions, including, but not limited to, Java primitive unboxing e.g., java.lang.Integer -> int e.g., java.util.List -> List
    • normalize

      Deprecated.
      normalizes the SymTypeExpression, e.g., (A & B[])[] -> (A[] & B[][])

      Within our type systems, each type has ONE normalized representation. This can be used to, e.g., compare SymTypeExpressions

    • leastUpperBound

      Deprecated.
      least upper bound for a set of types for e.g. union types unlike the Java counterpart, we specify it for non-reference types as well, making it more akin to Java conditional expressions, where "a?b:c" has type leastUpperBound(b,c)

      empty represents the universal type (aka the lack of a bound) Obscure is returned, if no lub could be calculated, e.g. lub(int, Person)

    • leastUpperBound

      default Optional<SymTypeExpression> leastUpperBound(SymTypeExpression... types)
      Deprecated.
    • numericPromotion

      SymTypeExpression numericPromotion(List<SymTypeExpression> types)
      Deprecated.
      calculates the one promoted numeric type, ignoring the specifics of the context s. Java spec. 20 5.6 e.g., short -> int e.g., byte, float -> float
    • numericPromotion

      default SymTypeExpression numericPromotion(SymTypeExpression... types)
      Deprecated.
    • isNumericType

      boolean isNumericType(SymTypeExpression type)
      Deprecated.
      test if the expression is of numeric type, e.g., in Java: (double, float, long, int, char, short, byte)
    • isIntegralType

      boolean isIntegralType(SymTypeExpression type)
      Deprecated.
      test if the expression is of integral type, e.g., in Java: (long, int, char, short, byte)
    • isBoolean

      boolean isBoolean(SymTypeExpression type)
      Deprecated.
    • isInt

      boolean isInt(SymTypeExpression type)
      Deprecated.
    • isDouble

      boolean isDouble(SymTypeExpression type)
      Deprecated.
    • isFloat

      boolean isFloat(SymTypeExpression type)
      Deprecated.
    • isLong

      boolean isLong(SymTypeExpression type)
      Deprecated.
    • isChar

      boolean isChar(SymTypeExpression type)
      Deprecated.
    • isShort

      boolean isShort(SymTypeExpression type)
      Deprecated.
    • isByte

      boolean isByte(SymTypeExpression type)
      Deprecated.
    • isString

      boolean isString(SymTypeExpression type)
      Deprecated.