KT-14400: Properly handle TypeAliasConstructorDescriptor in KotlinTypeMapper.mapToCallableMethod(...)

Implement getDefaultType() in TypeAliasDescriptor subclasses.
This commit is contained in:
Dmitry Petrov
2016-10-18 16:07:30 +03:00
parent 7dce1f438f
commit c41ec1ddfb
12 changed files with 68 additions and 5 deletions
@@ -133,6 +133,8 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
get() = builtIns.nullableAnyType
override val expandedType: SimpleType
get() = builtIns.nullableAnyType
override fun getDefaultType(): SimpleType =
builtIns.nullableAnyType
override fun substitute(substitutor: TypeSubstitutor) = this
@@ -155,6 +155,7 @@ class DeserializedTypeAliasDescriptor(
override lateinit var underlyingType: SimpleType private set
override lateinit var expandedType: SimpleType private set
private lateinit var typeConstructorParameters: List<TypeParameterDescriptor>
private lateinit var defaultTypeImpl: SimpleType private set
fun initialize(
declaredTypeParameters: List<TypeParameterDescriptor>,
@@ -165,8 +166,12 @@ class DeserializedTypeAliasDescriptor(
this.underlyingType = underlyingType
this.expandedType = expandedType
typeConstructorParameters = computeConstructorTypeParameters()
defaultTypeImpl = computeDefaultType()
}
override fun getDefaultType(): SimpleType =
defaultTypeImpl
override fun substitute(substitutor: TypeSubstitutor): TypeAliasDescriptor {
if (substitutor.isEmpty) return this
val substituted = DeserializedTypeAliasDescriptor(containingDeclaration, annotations, name, visibility, proto, nameResolver, typeTable, containerSource)