Minor. remove several methods from TypeUtils

This commit is contained in:
Stanislav Erokhin
2016-06-02 07:30:14 +03:00
parent f41c8dc045
commit a6da15f8e2
11 changed files with 22 additions and 37 deletions
@@ -27,9 +27,9 @@ import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.isDynamic
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
object CodegenUtil {
@@ -156,7 +156,7 @@ object CodegenUtil {
@JvmStatic
fun isEnumValueOfMethod(functionDescriptor: FunctionDescriptor): Boolean {
val methodTypeParameters = functionDescriptor.valueParameters
val nullableString = TypeUtils.makeNullable(functionDescriptor.builtIns.stringType)
val nullableString = functionDescriptor.builtIns.stringType.makeNullable()
return DescriptorUtils.ENUM_VALUE_OF == functionDescriptor.name
&& methodTypeParameters.size == 1
&& KotlinTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters[0].type, nullableString)
@@ -22,9 +22,9 @@ import org.jetbrains.kotlin.codegen.generateIsCheck
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.optimization.common.intConstant
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.types.typeUtil.makeNullableIfNeeded
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
@@ -43,7 +43,7 @@ class ReificationArgument(
)
fun reify(replacementAsmType: Type, kotlinType: KotlinType) =
Pair(Type.getType("[".repeat(arrayDepth) + replacementAsmType), kotlinType.arrayOf(arrayDepth).makeNullableIfNeeded(nullable))
Pair(Type.getType("[".repeat(arrayDepth) + replacementAsmType), TypeUtils.makeNullableIfNeeded(kotlinType.arrayOf(arrayDepth), nullable))
private fun KotlinType.arrayOf(arrayDepth: Int): KotlinType {
val builtins = this.builtIns
@@ -73,7 +73,7 @@ public class SingleAbstractMethodUtils {
if (FlexibleTypesKt.isNullabilityFlexible(samType)) {
SimpleType simpleType = KotlinTypeKt.asSimpleType(type);
return KotlinTypeFactory.flexibleType(simpleType, TypeUtils.makeNullable(simpleType));
return KotlinTypeFactory.flexibleType(simpleType, simpleType.makeNullableAsSpecified(true));
}
return TypeUtils.makeNullableAsSpecified(type, samType.isMarkedNullable());
@@ -103,7 +103,7 @@ object NonExpansiveInheritanceRestrictionChecker {
val constituents = constituentTypes(setOf(typeProjection.type))
for (typeParameter in typeParameters) {
if (typeParameter.defaultType in constituents || TypeUtils.makeNullable(typeParameter.defaultType) in constituents) {
if (typeParameter.defaultType in constituents || typeParameter.defaultType.makeNullableAsSpecified(true) in constituents) {
addEdge(typeParameter, constituentTypeConstructor.parameters[i], !TypeUtils.isTypeParameter(typeProjection.type))
}
}
@@ -126,7 +126,7 @@ object NonExpansiveInheritanceRestrictionChecker {
val boundClosure = boundClosure(bounds)
val constituentTypes = constituentTypes(boundClosure)
for (typeParameter in typeParameters) {
if (typeParameter.defaultType in constituentTypes || TypeUtils.makeNullable(typeParameter.defaultType) in constituentTypes) {
if (typeParameter.defaultType in constituentTypes || typeParameter.defaultType.makeNullableAsSpecified(true) in constituentTypes) {
addEdge(typeParameter, originalTypeParameter, true)
}
}