Interface ITypeComputationResult

  • All Known Implementing Classes:
    NoTypeResult, ResolutionBasedComputationResult

    public interface ITypeComputationResult
    The result of the type computation for a given expression. This result may be a lazy result, thus the real type is determined when getActualExpressionType() or other properties are queried. A type computation result distinguishes between return types and actual types for expressions. Consider the following scenario:
       val x = if (guard) return 'dummy' else 1
     
    The return type of the if expression is the type Comparable<?> & Serializable while the actual type of the conditional expression is type int. The first branch of the condition will never complete normally thus its type is not considered for the local expression type computation.
    • Method Detail

      • getActualExpressionType

        LightweightTypeReference getActualExpressionType()
        Returns the type of the expression (if known). May return null.
      • getExpectedExpressionType

        LightweightTypeReference getExpectedExpressionType()
        Returns the type of the expectation (if any). TODO expose the ITypeExpectation instead which carries more information.
      • getReturnType

        LightweightTypeReference getReturnType()
        Returns the return type of the expression (if known). May return null. The return type is different from the actual type since its value escapes the current context.
      • getExpression

        XExpression getExpression()
        The expression that is associated with this result.
      • getConformanceHints

        java.util.EnumSet<ConformanceHint> getConformanceHints()
        Conformance information about the actual expression type and the expectation.
      • getConformanceFlags

        int getConformanceFlags()
        Conformance information about the actual expression type and the expectation.
      • getCheckedConformanceHints

        java.util.EnumSet<ConformanceHint> getCheckedConformanceHints()
        Conformance information about the actual expression type and the expectation.
      • getCheckedConformanceFlags

        int getCheckedConformanceFlags()
        Conformance information about the actual expression type and the expectation.