org.jetbrains.jet.lang.types.expressions
Class ExpressionTypingUtils

java.lang.Object
  extended by org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils

public class ExpressionTypingUtils
extends java.lang.Object


Field Summary
static JetType CANT_INFER_LAMBDA_PARAM_TYPE
           
 
Method Summary
static java.util.List<CallableDescriptor> canFindSuitableCall(FqName callableFQN, com.intellij.openapi.project.Project project, JetExpression receiverExpression, JetType receiverType, JetScope scope, ModuleDescriptor module)
          Check that function or property with the given qualified name can be resolved in given scope and called on given receiver
static void checkCapturingInClosure(JetSimpleNameExpression expression, BindingTrace trace, JetScope scope)
           
static boolean checkIsExtensionCallable(ReceiverValue receiverArgument, CallableDescriptor callableDescriptor)
           
static void checkVariableShadowing(ExpressionTypingContext context, VariableDescriptor variableDescriptor, VariableDescriptor oldDescriptor)
           
static JetExpression createFakeExpressionOfType(com.intellij.openapi.project.Project project, BindingTrace trace, java.lang.String argumentName, JetType argumentType)
           
static void defineLocalVariablesFromMultiDeclaration(WritableScope writableScope, JetMultiDeclaration multiDeclaration, ReceiverValue receiver, JetExpression reportErrorsOn, ExpressionTypingContext context)
           
static boolean ensureBooleanResult(JetExpression operationSign, Name name, JetType resultType, ExpressionTypingContext context)
           
static boolean ensureBooleanResultWithCustomSubject(JetExpression operationSign, JetType resultType, java.lang.String subjectName, ExpressionTypingContext context)
           
static JetType getDefaultType(com.intellij.psi.tree.IElementType constantType)
           
protected static ExpressionReceiver getExpressionReceiver(ExpressionTypingFacade facade, JetExpression expression, ExpressionTypingContext context)
           
protected static ExpressionReceiver getExpressionReceiver(JetExpression expression, JetType type)
           
static JetTypeInfo getTypeInfoOrNullType(JetExpression expression, ExpressionTypingContext context, org.jetbrains.jet.lang.types.expressions.ExpressionTypingInternals facade)
           
static boolean isBoolean(JetType type)
           
static boolean isTypeFlexible(JetExpression expression)
           
static boolean isVariableIterable(ExpressionTypingServices expressionTypingServices, com.intellij.openapi.project.Project project, VariableDescriptor variableDescriptor, JetScope scope)
           
static com.intellij.openapi.util.Pair<Call,OverloadResolutionResults<FunctionDescriptor>> makeAndResolveFakeCall(ReceiverValue receiver, ExpressionTypingContext context, java.util.List<JetExpression> valueArguments, Name name)
           
static ObservableBindingTrace makeTraceInterceptingTypeMismatch(BindingTrace trace, JetElement expressionToWatch, boolean[] mismatchFound)
           
static WritableScopeImpl newWritableScopeImpl(ExpressionTypingContext context, java.lang.String scopeDebugName)
           
static OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(ExpressionTypingContext context, ReceiverValue receiver, Name name)
           
static OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(ExpressionTypingContext context, ReceiverValue receiver, Name name, JetType... argumentTypes)
           
protected static ExpressionReceiver safeGetExpressionReceiver(ExpressionTypingFacade facade, JetExpression expression, ExpressionTypingContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANT_INFER_LAMBDA_PARAM_TYPE

public static final JetType CANT_INFER_LAMBDA_PARAM_TYPE
Method Detail

getExpressionReceiver

@Nullable
protected static ExpressionReceiver getExpressionReceiver(@NotNull
                                                                   JetExpression expression,
                                                                   @Nullable
                                                                   JetType type)

getExpressionReceiver

@Nullable
protected static ExpressionReceiver getExpressionReceiver(@NotNull
                                                                   ExpressionTypingFacade facade,
                                                                   @NotNull
                                                                   JetExpression expression,
                                                                   ExpressionTypingContext context)

safeGetExpressionReceiver

@NotNull
protected static ExpressionReceiver safeGetExpressionReceiver(@NotNull
                                                                      ExpressionTypingFacade facade,
                                                                      @NotNull
                                                                      JetExpression expression,
                                                                      ExpressionTypingContext context)

newWritableScopeImpl

@NotNull
public static WritableScopeImpl newWritableScopeImpl(ExpressionTypingContext context,
                                                             @NotNull
                                                             java.lang.String scopeDebugName)

isBoolean

public static boolean isBoolean(@NotNull
                                JetType type)

ensureBooleanResult

public static boolean ensureBooleanResult(JetExpression operationSign,
                                          Name name,
                                          JetType resultType,
                                          ExpressionTypingContext context)

ensureBooleanResultWithCustomSubject

public static boolean ensureBooleanResultWithCustomSubject(JetExpression operationSign,
                                                           JetType resultType,
                                                           java.lang.String subjectName,
                                                           ExpressionTypingContext context)

getDefaultType

@NotNull
public static JetType getDefaultType(com.intellij.psi.tree.IElementType constantType)

isTypeFlexible

public static boolean isTypeFlexible(@Nullable
                                     JetExpression expression)

checkCapturingInClosure

public static void checkCapturingInClosure(JetSimpleNameExpression expression,
                                           BindingTrace trace,
                                           JetScope scope)

isVariableIterable

public static boolean isVariableIterable(@NotNull
                                         ExpressionTypingServices expressionTypingServices,
                                         @NotNull
                                         com.intellij.openapi.project.Project project,
                                         @NotNull
                                         VariableDescriptor variableDescriptor,
                                         @NotNull
                                         JetScope scope)

canFindSuitableCall

public static java.util.List<CallableDescriptor> canFindSuitableCall(@NotNull
                                                                     FqName callableFQN,
                                                                     @NotNull
                                                                     com.intellij.openapi.project.Project project,
                                                                     @NotNull
                                                                     JetExpression receiverExpression,
                                                                     @NotNull
                                                                     JetType receiverType,
                                                                     @NotNull
                                                                     JetScope scope,
                                                                     @NotNull
                                                                     ModuleDescriptor module)
Check that function or property with the given qualified name can be resolved in given scope and called on given receiver

Parameters:
callableFQN -
project -
scope -
Returns:

checkIsExtensionCallable

public static boolean checkIsExtensionCallable(@NotNull
                                               ReceiverValue receiverArgument,
                                               @NotNull
                                               CallableDescriptor callableDescriptor)

resolveFakeCall

@NotNull
public static OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(@NotNull
                                                                                    ExpressionTypingContext context,
                                                                                    @NotNull
                                                                                    ReceiverValue receiver,
                                                                                    @NotNull
                                                                                    Name name,
                                                                                    @NotNull
                                                                                    JetType... argumentTypes)

createFakeExpressionOfType

public static JetExpression createFakeExpressionOfType(@NotNull
                                                       com.intellij.openapi.project.Project project,
                                                       @NotNull
                                                       BindingTrace trace,
                                                       @NotNull
                                                       java.lang.String argumentName,
                                                       @NotNull
                                                       JetType argumentType)

resolveFakeCall

@NotNull
public static OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(@NotNull
                                                                                    ExpressionTypingContext context,
                                                                                    @NotNull
                                                                                    ReceiverValue receiver,
                                                                                    @NotNull
                                                                                    Name name)

makeAndResolveFakeCall

@NotNull
public static com.intellij.openapi.util.Pair<Call,OverloadResolutionResults<FunctionDescriptor>> makeAndResolveFakeCall(@NotNull
                                                                                                                                ReceiverValue receiver,
                                                                                                                                @NotNull
                                                                                                                                ExpressionTypingContext context,
                                                                                                                                @NotNull
                                                                                                                                java.util.List<JetExpression> valueArguments,
                                                                                                                                @NotNull
                                                                                                                                Name name)

defineLocalVariablesFromMultiDeclaration

public static void defineLocalVariablesFromMultiDeclaration(@NotNull
                                                            WritableScope writableScope,
                                                            @NotNull
                                                            JetMultiDeclaration multiDeclaration,
                                                            @NotNull
                                                            ReceiverValue receiver,
                                                            @NotNull
                                                            JetExpression reportErrorsOn,
                                                            @NotNull
                                                            ExpressionTypingContext context)

checkVariableShadowing

public static void checkVariableShadowing(@NotNull
                                          ExpressionTypingContext context,
                                          @NotNull
                                          VariableDescriptor variableDescriptor,
                                          VariableDescriptor oldDescriptor)

makeTraceInterceptingTypeMismatch

public static ObservableBindingTrace makeTraceInterceptingTypeMismatch(@NotNull
                                                                       BindingTrace trace,
                                                                       @NotNull
                                                                       JetElement expressionToWatch,
                                                                       @NotNull
                                                                       boolean[] mismatchFound)

getTypeInfoOrNullType

@NotNull
public static JetTypeInfo getTypeInfoOrNullType(@Nullable
                                                        JetExpression expression,
                                                        @NotNull
                                                        ExpressionTypingContext context,
                                                        @NotNull
                                                        org.jetbrains.jet.lang.types.expressions.ExpressionTypingInternals facade)