Restore nullability after type refinement along with annotations
See the issue for details ^KT-42546 Fixed
This commit is contained in:
@@ -67,7 +67,8 @@ class KotlinTypeRefinerImpl(
|
||||
val cached = refinedTypeCache.computeIfAbsent(type.constructor) {
|
||||
type.constructor.declarationDescriptor!!.defaultType.refine(this)
|
||||
}
|
||||
cached.replace(type.arguments)
|
||||
|
||||
cached.restoreAdditionalTypeInformation(type)
|
||||
}
|
||||
else -> type.refine(this)
|
||||
}
|
||||
@@ -146,3 +147,7 @@ private val TypeConstructor.allDependentTypeConstructors: Collection<TypeConstru
|
||||
|
||||
private fun TypeConstructor.isExpectClass() =
|
||||
declarationDescriptor?.safeAs<ClassDescriptor>()?.isExpect == true
|
||||
|
||||
private fun KotlinType.restoreAdditionalTypeInformation(prototype: KotlinType): KotlinType {
|
||||
return TypeUtils.makeNullableAsSpecified(this, prototype.isMarkedNullable).replace(prototype.arguments)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user