Refactoring. Move flexible type creation to KotlinTypeFactory.
This commit is contained in:
+2
-3
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.java
|
||||
|
||||
import org.jetbrains.kotlin.load.java.lazy.types.LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver.TypeTransformerForTests
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
object InternalFlexibleTypeTransformer : TypeTransformerForTests() {
|
||||
// This is a "magic" classifier: when type resolver sees it in the code, e.g. ft<Foo, Foo?>, instead of creating a normal type,
|
||||
@@ -35,7 +34,7 @@ object InternalFlexibleTypeTransformer : TypeTransformerForTests() {
|
||||
val descriptor = kotlinType.constructor.declarationDescriptor
|
||||
if (descriptor != null && FLEXIBLE_TYPE_CLASSIFIER.asSingleFqName().toUnsafe() == DescriptorUtils.getFqName(descriptor)
|
||||
&& kotlinType.arguments.size == 2) {
|
||||
return FlexibleJavaClassifierTypeFactory.create(kotlinType.arguments[0].type, kotlinType.arguments[1].type)
|
||||
return KotlinTypeFactory.flexibleType(kotlinType.arguments[0].type.asSimpleType(), kotlinType.arguments[1].type.asSimpleType())
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
+2
-1
@@ -72,7 +72,8 @@ public class SingleAbstractMethodUtils {
|
||||
"' should not end with conflict";
|
||||
|
||||
if (FlexibleTypesKt.isNullabilityFlexible(samType)) {
|
||||
return LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.INSTANCE.create(type, TypeUtils.makeNullable(type));
|
||||
SimpleType simpleType = KotlinTypeKt.asSimpleType(type);
|
||||
return KotlinTypeFactory.flexibleType(simpleType, TypeUtils.makeNullable(simpleType));
|
||||
}
|
||||
|
||||
return TypeUtils.makeNullableAsSpecified(type, samType.isMarkedNullable());
|
||||
|
||||
Reference in New Issue
Block a user