Implement makeNullableAsSpecified for TypeTemplate properly
This change fixes an SOE in isCastErased:
@JvmStatic
fun isCastErased(supertype: KotlinType, subtype: KotlinType, typeChecker: KotlinTypeChecker): Boolean {
if (supertype.isMarkedNullable || subtype.isMarkedNullable) {
return isCastErased(TypeUtils.makeNotNullable(supertype), TypeUtils.makeNotNullable(subtype), typeChecker)
}
TypeUtils.makeNotNullable(TypeTemplate) should not return the same object
if isMarkedNullable returned true on the instance
#KT-15516 Fixed
This commit is contained in:
+7
-3
@@ -56,11 +56,15 @@ import javax.inject.Inject
|
||||
|
||||
class TypeTemplate(
|
||||
val typeVariable: TypeVariable,
|
||||
val coroutineInferenceData: CoroutineInferenceData
|
||||
) : FlexibleType(typeVariable.originalTypeParameter.builtIns.nothingType, typeVariable.originalTypeParameter.builtIns.nullableAnyType) {
|
||||
val coroutineInferenceData: CoroutineInferenceData,
|
||||
nullable: Boolean = true
|
||||
) : FlexibleType(
|
||||
typeVariable.originalTypeParameter.builtIns.nothingType,
|
||||
typeVariable.originalTypeParameter.builtIns.anyType.makeNullableAsSpecified(nullable)
|
||||
) {
|
||||
override fun replaceAnnotations(newAnnotations: Annotations) = this
|
||||
|
||||
override fun makeNullableAsSpecified(newNullability: Boolean) = this
|
||||
override fun makeNullableAsSpecified(newNullability: Boolean) = TypeTemplate(typeVariable, coroutineInferenceData, newNullability)
|
||||
|
||||
override val delegate: SimpleType
|
||||
get() = upperBound
|
||||
|
||||
Reference in New Issue
Block a user