Make freshly substituted type variables def not nullable if they come from not null type parameter
^KT-48778 Fixed
This commit is contained in:
+6
-1
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.CompositeAnnotations
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableFromCallableDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.substitute
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
@@ -157,7 +158,11 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
replacement = replacement.makeDefinitelyNotNullOrNotNull()
|
||||
}
|
||||
if (type is CustomTypeParameter) {
|
||||
replacement = type.substitutionResult(replacement).unwrap()
|
||||
replacement = type.substitutionResult(replacement).unwrap().run {
|
||||
if (type is NotNullTypeVariable && replacement.constructor is TypeVariableTypeConstructor) {
|
||||
makeDefinitelyNotNullOrNotNull()
|
||||
} else this
|
||||
}
|
||||
}
|
||||
|
||||
return replacement
|
||||
|
||||
Reference in New Issue
Block a user