org.jetbrains.jet.lang.types
Class TypeUtils

java.lang.Object
  extended by org.jetbrains.jet.lang.types.TypeUtils

public class TypeUtils
extends java.lang.Object


Nested Class Summary
static class TypeUtils.SpecialType
           
 
Field Summary
static JetType CANT_INFER_LAMBDA_PARAM_TYPE
           
static JetType CANT_INFER_TYPE_PARAMETER
           
static JetType DONT_CARE
           
static JetType NO_EXPECTED_TYPE
           
static JetType PLACEHOLDER_FUNCTION_TYPE
           
static JetType UNIT_EXPECTED_TYPE
           
 
Constructor Summary
TypeUtils()
           
 
Method Summary
static boolean canHaveSubtypes(JetTypeChecker typeChecker, JetType type)
           
static JetType commonSupertypeForNumberTypes(java.util.Collection<JetType> numberLowerBounds)
           
static boolean dependsOnTypeConstructors(JetType type, java.util.Collection<TypeConstructor> typeParameterConstructors)
           
static boolean dependsOnTypeParameters(JetType type, java.util.Collection<TypeParameterDescriptor> typeParameters)
           
static boolean equalClasses(JetType type1, JetType type2)
           
static boolean equalsOrContainsAsArgument(JetType type, JetType... possibleArgumentTypes)
           
static boolean equalTypes(JetType a, JetType b)
           
static com.intellij.openapi.util.Pair<java.util.Collection<JetType>,java.util.Collection<JetType>> filterNumberTypes(java.util.Collection<JetType> types)
           
static java.util.List<ClassDescriptor> getAllClassDescriptors(JetType type)
           
static java.util.Set<JetType> getAllSupertypes(JetType type)
           
static ClassDescriptor getClassDescriptor(JetType type)
           
static JetType getDefaultPrimitiveNumberType(NumberValueTypeConstructor numberValueTypeConstructor)
           
static java.util.List<TypeProjection> getDefaultTypeProjections(java.util.List<TypeParameterDescriptor> parameters)
           
static java.util.List<JetType> getDefaultTypes(java.util.List<TypeParameterDescriptor> parameters)
           
static java.util.List<JetType> getImmediateSupertypes(JetType type)
           
static JetType getPrimitiveNumberType(NumberValueTypeConstructor numberValueTypeConstructor, JetType expectedType)
           
static java.lang.String getTypeNameAndStarProjectionsString(java.lang.String name, int size)
           
static boolean hasNullableLowerBound(TypeParameterDescriptor typeParameterDescriptor)
           
static boolean hasNullableSuperType(JetType type)
           
static JetType intersect(JetTypeChecker typeChecker, java.util.Set<JetType> types)
           
static boolean isIntersectionEmpty(JetType typeA, JetType typeB)
           
static TypeSubstitutor makeConstantSubstitutor(java.util.Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type)
           
static JetType makeNotNullable(JetType type)
           
static JetType makeNullable(JetType type)
           
static JetType makeNullableAsSpecified(JetType type, boolean nullable)
           
static JetType makeNullableIfNeeded(JetType type, boolean nullable)
           
static TypeSubstitutor makeSubstitutorForTypeParametersMap(java.util.Map<TypeParameterDescriptor,TypeProjection> substitutionContext)
           
static JetType makeUnsubstitutedType(ClassDescriptor classDescriptor, JetScope unsubstitutedMemberScope)
           
static boolean noExpectedType(JetType type)
           
static JetType substituteParameters(ClassDescriptor clazz, java.util.List<JetType> typeArguments)
           
static JetType substituteProjectionsForParameters(ClassDescriptor clazz, java.util.List<TypeProjection> projections)
           
static java.util.List<TypeConstructor> topologicallySortSuperclassesAndRecordAllInstances(JetType type, java.util.Map<TypeConstructor,java.util.Set<JetType>> constructorToAllInstances, java.util.Set<TypeConstructor> visited)
           
static boolean typeConstructorUsedInType(TypeConstructor key, JetType value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DONT_CARE

public static final JetType DONT_CARE

CANT_INFER_TYPE_PARAMETER

public static final JetType CANT_INFER_TYPE_PARAMETER

PLACEHOLDER_FUNCTION_TYPE

public static final JetType PLACEHOLDER_FUNCTION_TYPE

CANT_INFER_LAMBDA_PARAM_TYPE

public static final JetType CANT_INFER_LAMBDA_PARAM_TYPE

NO_EXPECTED_TYPE

public static final JetType NO_EXPECTED_TYPE

UNIT_EXPECTED_TYPE

public static final JetType UNIT_EXPECTED_TYPE
Constructor Detail

TypeUtils

public TypeUtils()
Method Detail

noExpectedType

public static boolean noExpectedType(@NotNull
                                     JetType type)

makeNullable

@NotNull
public static JetType makeNullable(@NotNull
                                           JetType type)

makeNotNullable

@NotNull
public static JetType makeNotNullable(@NotNull
                                              JetType type)

makeNullableAsSpecified

@NotNull
public static JetType makeNullableAsSpecified(@NotNull
                                                      JetType type,
                                                      boolean nullable)

isIntersectionEmpty

public static boolean isIntersectionEmpty(@NotNull
                                          JetType typeA,
                                          @NotNull
                                          JetType typeB)

intersect

@Nullable
public static JetType intersect(@NotNull
                                         JetTypeChecker typeChecker,
                                         @NotNull
                                         java.util.Set<JetType> types)

canHaveSubtypes

public static boolean canHaveSubtypes(JetTypeChecker typeChecker,
                                      JetType type)

makeNullableIfNeeded

public static JetType makeNullableIfNeeded(JetType type,
                                           boolean nullable)

makeUnsubstitutedType

@NotNull
public static JetType makeUnsubstitutedType(ClassDescriptor classDescriptor,
                                                    JetScope unsubstitutedMemberScope)

getDefaultTypeProjections

@NotNull
public static java.util.List<TypeProjection> getDefaultTypeProjections(java.util.List<TypeParameterDescriptor> parameters)

getDefaultTypes

@NotNull
public static java.util.List<JetType> getDefaultTypes(java.util.List<TypeParameterDescriptor> parameters)

getImmediateSupertypes

@NotNull
public static java.util.List<JetType> getImmediateSupertypes(@NotNull
                                                                     JetType type)

getAllSupertypes

@NotNull
public static java.util.Set<JetType> getAllSupertypes(@NotNull
                                                              JetType type)

hasNullableLowerBound

public static boolean hasNullableLowerBound(@NotNull
                                            TypeParameterDescriptor typeParameterDescriptor)

hasNullableSuperType

public static boolean hasNullableSuperType(@NotNull
                                           JetType type)

equalClasses

public static boolean equalClasses(@NotNull
                                   JetType type1,
                                   @NotNull
                                   JetType type2)

getClassDescriptor

@Nullable
public static ClassDescriptor getClassDescriptor(@NotNull
                                                          JetType type)

substituteParameters

@NotNull
public static JetType substituteParameters(@NotNull
                                                   ClassDescriptor clazz,
                                                   @NotNull
                                                   java.util.List<JetType> typeArguments)

substituteProjectionsForParameters

@NotNull
public static JetType substituteProjectionsForParameters(@NotNull
                                                                 ClassDescriptor clazz,
                                                                 @NotNull
                                                                 java.util.List<TypeProjection> projections)

getAllClassDescriptors

@NotNull
public static java.util.List<ClassDescriptor> getAllClassDescriptors(@NotNull
                                                                             JetType type)

equalTypes

public static boolean equalTypes(@NotNull
                                 JetType a,
                                 @NotNull
                                 JetType b)

typeConstructorUsedInType

public static boolean typeConstructorUsedInType(@NotNull
                                                TypeConstructor key,
                                                @NotNull
                                                JetType value)

dependsOnTypeParameters

public static boolean dependsOnTypeParameters(@NotNull
                                              JetType type,
                                              @NotNull
                                              java.util.Collection<TypeParameterDescriptor> typeParameters)

dependsOnTypeConstructors

public static boolean dependsOnTypeConstructors(@NotNull
                                                JetType type,
                                                @NotNull
                                                java.util.Collection<TypeConstructor> typeParameterConstructors)

equalsOrContainsAsArgument

public static boolean equalsOrContainsAsArgument(@Nullable
                                                 JetType type,
                                                 @NotNull
                                                 JetType... possibleArgumentTypes)

getTypeNameAndStarProjectionsString

@NotNull
public static java.lang.String getTypeNameAndStarProjectionsString(@NotNull
                                                                           java.lang.String name,
                                                                           int size)

commonSupertypeForNumberTypes

@Nullable
public static JetType commonSupertypeForNumberTypes(@NotNull
                                                             java.util.Collection<JetType> numberLowerBounds)

getDefaultPrimitiveNumberType

@NotNull
public static JetType getDefaultPrimitiveNumberType(@NotNull
                                                            NumberValueTypeConstructor numberValueTypeConstructor)

getPrimitiveNumberType

@NotNull
public static JetType getPrimitiveNumberType(@NotNull
                                                     NumberValueTypeConstructor numberValueTypeConstructor,
                                                     @NotNull
                                                     JetType expectedType)

filterNumberTypes

@NotNull
public static com.intellij.openapi.util.Pair<java.util.Collection<JetType>,java.util.Collection<JetType>> filterNumberTypes(@NotNull
                                                                                                                                    java.util.Collection<JetType> types)

topologicallySortSuperclassesAndRecordAllInstances

public static java.util.List<TypeConstructor> topologicallySortSuperclassesAndRecordAllInstances(@NotNull
                                                                                                 JetType type,
                                                                                                 @NotNull
                                                                                                 java.util.Map<TypeConstructor,java.util.Set<JetType>> constructorToAllInstances,
                                                                                                 @NotNull
                                                                                                 java.util.Set<TypeConstructor> visited)

makeConstantSubstitutor

public static TypeSubstitutor makeConstantSubstitutor(java.util.Collection<TypeParameterDescriptor> typeParameterDescriptors,
                                                      JetType type)

makeSubstitutorForTypeParametersMap

public static TypeSubstitutor makeSubstitutorForTypeParametersMap(@NotNull
                                                                  java.util.Map<TypeParameterDescriptor,TypeProjection> substitutionContext)