diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java index 6789495140a..4fee2d77e31 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java @@ -26,6 +26,8 @@ import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.builtins.KotlinBuiltIns; +import org.jetbrains.kotlin.config.LanguageFeature; +import org.jetbrains.kotlin.config.LanguageVersionSettings; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.annotations.Annotations; import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl; @@ -116,7 +118,7 @@ public class ControlStructureTypingUtils { SimpleFunctionDescriptorImpl function = createFunctionDescriptorForSpecialConstruction( construct, argumentNames, isArgumentNullable); TracingStrategy tracing = createTracingForSpecialConstruction(call, construct.getName(), context); - TypeSubstitutor knownTypeParameterSubstitutor = createKnownTypeParameterSubstitutorForSpecialCall(construct, function, context.expectedType); + TypeSubstitutor knownTypeParameterSubstitutor = createKnownTypeParameterSubstitutorForSpecialCall(construct, function, context.expectedType, context.languageVersionSettings); ResolutionCandidate resolutionCandidate = ResolutionCandidate.create(call, function, knownTypeParameterSubstitutor); OverloadResolutionResults results = callResolver.resolveCallWithKnownCandidate( @@ -128,9 +130,11 @@ public class ControlStructureTypingUtils { private static @Nullable TypeSubstitutor createKnownTypeParameterSubstitutorForSpecialCall( @NotNull ResolveConstruct construct, @NotNull SimpleFunctionDescriptorImpl function, - @NotNull KotlinType expectedType + @NotNull KotlinType expectedType, + @NotNull LanguageVersionSettings languageVersionSettings ) { if (construct == ResolveConstruct.ELVIS + || construct == ResolveConstruct.EXCL_EXCL || TypeUtils.noExpectedType(expectedType) || TypeUtils.isDontCarePlaceholder(expectedType) || KotlinBuiltIns.isUnitOrNullableUnit(expectedType) diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt index 41a54e0d20b..44ab59dbf82 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt @@ -34,6 +34,6 @@ fun main(args : Array) { } } - val f : String = a!! + val f : String = a!! checkSubtype(a!!) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt index 736e875327e..e9fcaffc8dd 100644 --- a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt +++ b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt @@ -3,7 +3,7 @@ fun main(args : Array) { val a : Int? = null; var v = 1 val b : String = v; - val f : String = a!!; + val f : String = a!!; val g : String = v++; val g1 : String = ++v; val h : String = v--;