Revert "Make freshly substituted type variables def not nullable if they come from not null type parameter"

This reverts commit 41936a790b37bef45d7e7dad851856ea1750ef01.
This commit is contained in:
Victor Petukhov
2021-10-19 13:12:54 +03:00
parent 2261928f4f
commit e0a4704c21
12 changed files with 14 additions and 80 deletions
@@ -9,7 +9,6 @@ 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
@@ -158,11 +157,7 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
replacement = replacement.makeDefinitelyNotNullOrNotNull()
}
if (type is CustomTypeParameter) {
replacement = type.substitutionResult(replacement).unwrap().run {
if (type is NotNullTypeVariable && replacement.constructor is TypeVariableTypeConstructor) {
makeDefinitelyNotNullOrNotNull()
} else this
}
replacement = type.substitutionResult(replacement).unwrap()
}
return replacement