Class InferenceResult

java.lang.Object
de.monticore.types3.generics.context.InferenceResult

public class InferenceResult extends Object
Internal results of inference. This one stores information to be passed 'upwards' in the AST. This is done as, depending on the expression, multiple passes can be required. It is used until a compile-time type (a type without free type variables) can be calculated and stored in Type4Ast.
  • Field Details

  • Constructor Details

    • InferenceResult

      public InferenceResult()
  • Method Details

    • getLastInferenceMode

      public InferenceVisitorMode getLastInferenceMode()
      Returns:
      the last mode used to collect information
    • setLastInferenceMode

      public void setLastInferenceMode(InferenceVisitorMode mode)
    • hasErrorOccurred

      public boolean hasErrorOccurred()
    • setHasErrorOccurred

      public void setHasErrorOccurred()
    • hasResolvedFunction

      public boolean hasResolvedFunction()
    • hasResolvedNonInvocationType

      public boolean hasResolvedNonInvocationType()
    • getResolvedFunction

      public SymTypeOfFunction getResolvedFunction()
      A function, either required by an invocation, or by assignment, e.g., (a?b:c)(1) // here, b and c are required to be functions (int) -> void f = a; // here, a is required to be a function Only call if hasResolvedFunction() returns true.
    • setResolvedFunction

      public void setResolvedFunction(SymTypeOfFunction resolvedFunction)
    • getResolvedNonInvocationType

      public SymTypeExpression getResolvedNonInvocationType()
      Can be a function, but in the context, no function was required. There are no bounds and the type cannot have inference vars. Only call if hasResolvedFunction() returns false.
    • setResolvedNonInvocationType

      public void setResolvedNonInvocationType(SymTypeExpression resolvedNonInvocationType)
    • getB0

      public List<Bound> getB0()
      Function parameter bounds s. JLS 21 18.1.3 B0
    • setB0

      public void setB0(List<Bound> b0)
    • getB2

      public List<Bound> getB2()
      Function applicability bounds s. JLS 21 18.5.1 B2
    • setB2

      public void setB2(List<Bound> b2)
    • getApplicabilityInstantiation

      public Optional<SymTypeOfFunction> getApplicabilityInstantiation()
    • getB3

      public List<Bound> getB3()
      Function invocation compatibility bounds s. JLS 21 18.5.2.1 B3
    • setB3

      public void setB3(List<Bound> b3)
    • getInvocationCompatibilityInstantiation

      public Optional<SymTypeOfFunction> getInvocationCompatibilityInstantiation()
    • getB4C

      Function invocation type constraints used to get function invocation type bounds s. JLS 21 18.5.2.2 C
    • setB4C

      public void setB4C(List<ExpressionCompatibilityConstraint> b4C)
    • getB4

      public List<Bound> getB4()
      Function invocation type bounds s. JLS 21 18.5.2.2 B4
    • setB4

      public void setB4(List<Bound> b4)
    • getInvocationType

      public Optional<SymTypeOfFunction> getInvocationType()
    • getCompileTimeType

      public Optional<SymTypeExpression> getCompileTimeType()
      Gets the compile-time type. This is either the getInvocationType() or getResolvedNonInvocationType().
    • getResolvedFunction

      protected Optional<SymTypeOfFunction> getResolvedFunction(List<Bound> bounds)
      During many checks (s. InferenceVisitorMode), it is required to check whether resolution of a set of bounds succeeds. In Addition to this information, the corresponding instantiation of the function is returned on success.