From 5582fd40567c10d0e0582a8bdee980e4af5d6c30 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Thu, 31 Oct 2019 14:51:30 +0300 Subject: [PATCH] [NI] Discard `DefNotNull` types inside invariant positions #KT-30297 Fixed #KT-32168 Fixed #KT-27722 Fixed (actually, it was fixed with addition of DefNotNullTypes, and now test was added to save this behavior) #KT-32345 Fixed --- .../fir/FirDiagnosticsSmokeTestGenerated.java | 10 ++++ .../tower/KotlinToResolvedCallTransformer.kt | 15 ++++-- .../resolve/calls/inference/InferenceUtils.kt | 8 +-- .../kotlin/types/TypeApproximator.kt | 20 +++++++- .../definitelyNotNullTypeInvariantPosition.kt | 24 +++++++++ ...definitelyNotNullTypeInvariantPosition.txt | 14 ++++++ ...ximationWithDefNotNullTypesAndDelegates.kt | 15 ++++++ ...imationWithDefNotNullTypesAndDelegates.txt | 19 +++++++ .../testsWithStdLib/inference/kt27772.kt | 9 ++++ .../testsWithStdLib/inference/kt27772.txt | 4 ++ .../testsWithStdLib/inference/kt32345.kt | 49 +++++++++++++++++++ .../testsWithStdLib/inference/kt32345.txt | 34 +++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 10 ++++ .../DiagnosticsTestWithStdLibGenerated.java | 10 ++++ ...ticsTestWithStdLibUsingJavacGenerated.java | 10 ++++ .../DiagnosticsUsingJavacTestGenerated.java | 10 ++++ 16 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt create mode 100644 compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.txt create mode 100644 compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt create mode 100644 compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.txt diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java index 0c22a179296..1a70e6828bc 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsSmokeTestGenerated.java @@ -10314,6 +10314,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok runTest("compiler/testData/diagnostics/tests/inference/constraints/constraintOnFunctionLiteral.kt"); } + @TestMetadata("definitelyNotNullTypeInvariantPosition.kt") + public void testDefinitelyNotNullTypeInvariantPosition() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt"); + } + @TestMetadata("earlyCompletionForCalls.kt") public void testEarlyCompletionForCalls() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/earlyCompletionForCalls.kt"); @@ -10398,6 +10403,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok public void testSupertypeConstraintOnNullableType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/supertypeConstraintOnNullableType.kt"); } + + @TestMetadata("wrongApproximationWithDefNotNullTypesAndDelegates.kt") + public void testWrongApproximationWithDefNotNullTypesAndDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/inference/nestedCalls") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index a7ec273aad7..a1c9a76ba65 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewT import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.model.* import org.jetbrains.kotlin.resolve.calls.inference.substitute -import org.jetbrains.kotlin.resolve.calls.inference.substituteAndApproximateCapturedTypes +import org.jetbrains.kotlin.resolve.calls.inference.substituteAndApproximateTypes import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.makeNullableTypeIfSafeReceiver import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus @@ -699,15 +699,20 @@ class NewResolvedCallImpl( @Suppress("UNCHECKED_CAST") resultingDescriptor = run { val candidateDescriptor = resolvedCallAtom.candidateDescriptor - val containsCapturedTypes = resolvedCallAtom.candidateDescriptor.returnType?.contains { it is NewCapturedType } ?: false - val containsIntegerLiteralTypes = resolvedCallAtom.candidateDescriptor.returnType?.contains { it.constructor is IntegerLiteralTypeConstructor } ?: false + val returnType = resolvedCallAtom.candidateDescriptor.returnType + val shouldRunApproximation = returnType?.let { type -> + type.contains { it is NewCapturedType } || + type.contains { it.constructor is IntegerLiteralTypeConstructor } || + type.contains { it is DefinitelyNotNullType } + } ?: false when { candidateDescriptor is FunctionDescriptor || - (candidateDescriptor is PropertyDescriptor && (candidateDescriptor.typeParameters.isNotEmpty() || containsCapturedTypes || containsIntegerLiteralTypes)) -> + (candidateDescriptor is PropertyDescriptor && + (candidateDescriptor.typeParameters.isNotEmpty() || shouldRunApproximation)) -> // this code is very suspicious. Now it is very useful for BE, because they cannot do nothing with captured types, // but it seems like temporary solution. - candidateDescriptor.substitute(resolvedCallAtom.substitutor).substituteAndApproximateCapturedTypes( + candidateDescriptor.substitute(resolvedCallAtom.substitutor).substituteAndApproximateTypes( substitutor ?: FreshVariableNewTypeSubstitutor.Empty, typeApproximator ) else -> diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/InferenceUtils.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/InferenceUtils.kt index 94e0689174b..67a6625565d 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/InferenceUtils.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/InferenceUtils.kt @@ -73,7 +73,7 @@ fun CallableDescriptor.substitute(substitutor: NewTypeSubstitutor): CallableDesc return substitute(TypeSubstitutor.create(wrappedSubstitution)) } -fun CallableDescriptor.substituteAndApproximateCapturedTypes( +fun CallableDescriptor.substituteAndApproximateTypes( substitutor: NewTypeSubstitutor, typeApproximator: TypeApproximator ): CallableDescriptor { @@ -82,8 +82,10 @@ fun CallableDescriptor.substituteAndApproximateCapturedTypes( override fun prepareTopLevelType(topLevelType: KotlinType, position: Variance) = substitutor.safeSubstitute(topLevelType.unwrap()).let { substitutedType -> - typeApproximator.approximateToSuperType(substitutedType, TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation) - ?: substitutedType + typeApproximator.approximateToSuperType( + substitutedType, + TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference + ) ?: substitutedType } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index 0ad5f3f698c..40df24883d9 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -41,6 +41,7 @@ open class TypeApproximatorConfiguration { open val errorType get() = false open val integerLiteralType: Boolean = false // IntegerLiteralTypeConstructor open val definitelyNotNullType get() = true + open val definitelyNotNullTypeInInvariantPosition get() = true open val intersection: IntersectionStrategy = TO_COMMON_SUPERTYPE open val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean = { false } @@ -88,6 +89,12 @@ open class TypeApproximatorConfiguration { override val integerLiteralType: Boolean get() = true } + object FinalApproximationAfterResolutionAndInference : + TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) { + override val integerLiteralType: Boolean get() = true + override val definitelyNotNullTypeInInvariantPosition: Boolean get() = false + } + object IntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AllFlexibleSameValue() { override val integerLiteralType: Boolean get() = true override val allFlexible: Boolean get() = true @@ -468,8 +475,17 @@ abstract class AbstractTypeApproximator(val ctx: TypeSystemInferenceExtensionCon if (argument.isStarProjection()) continue - val argumentType = argument.getType() - when (val effectiveVariance = AbstractTypeChecker.effectiveVariance(parameter.getVariance(), argument.getVariance())) { + val effectiveVariance = AbstractTypeChecker.effectiveVariance(parameter.getVariance(), argument.getVariance()) + if (effectiveVariance == TypeVariance.INV) { + val argumentType = argument.getType() + if (argumentType is DefinitelyNotNullTypeMarker && !conf.definitelyNotNullTypeInInvariantPosition) { + newArguments[index] = argumentType.original().withNullability(false).asTypeArgument() + } + } + + val argumentType = newArguments[index]?.getType() ?: argument.getType() + + when (effectiveVariance) { null -> { return if (conf.errorType) { createErrorType( diff --git a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt new file mode 100644 index 00000000000..79e74d4eed3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt @@ -0,0 +1,24 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION + +class Inv(val x: T?) + +fun create(y: K) = Inv(y) +fun createPrivate(y: K) = Inv(y) + +fun takeInvInt(i: Inv) {} + +fun test(i: Int, s: S) { + val a = Inv(s) + + ")!>a + + val b = create(i) + + ")!>b + + val c = createPrivate(i) + + ")!>c + + takeInvInt(create(i)) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.txt b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.txt new file mode 100644 index 00000000000..6d9da9d138e --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.txt @@ -0,0 +1,14 @@ +package + +public fun create(/*0*/ y: K): Inv +public fun createPrivate(/*0*/ y: K): Inv +public fun takeInvInt(/*0*/ i: Inv): kotlin.Unit +public fun test(/*0*/ i: kotlin.Int, /*1*/ s: S): kotlin.Unit + +public final class Inv { + public constructor Inv(/*0*/ x: T?) + public final val x: T? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt b/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt new file mode 100644 index 00000000000..e64a8ec1c4c --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt @@ -0,0 +1,15 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + +class Foo { + var test: String by refreshOnUpdate("str") + + fun refreshOnUpdate(initialValue: T) = RefreshDelegate(initialValue) + + class RefreshDelegate(initialValue: T?) { + operator fun getValue(thisRef: Foo, property: KProperty<*>): T = TODO() + + operator fun setValue(thisRef: Foo, property: KProperty<*>, value: T) {} + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.txt b/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.txt new file mode 100644 index 00000000000..276690e350d --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.txt @@ -0,0 +1,19 @@ +package + +public final class Foo { + public constructor Foo() + public final var test: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun refreshOnUpdate(/*0*/ initialValue: T): Foo.RefreshDelegate + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class RefreshDelegate { + public constructor RefreshDelegate(/*0*/ initialValue: T?) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun getValue(/*0*/ thisRef: Foo, /*1*/ property: kotlin.reflect.KProperty<*>): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun setValue(/*0*/ thisRef: Foo, /*1*/ property: kotlin.reflect.KProperty<*>, /*2*/ value: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt new file mode 100644 index 00000000000..3eb12f63243 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt @@ -0,0 +1,9 @@ +// !WITH_NEW_INFERENCE + +fun foo(resources: List) { + resources.map { runCatching { it } }.mapNotNull { it.getOrNull() } +} + +fun bar(resources: List) { + resources.map { runCatching { it } }.mapNotNull { it.getOrNull() } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.txt new file mode 100644 index 00000000000..51e3c7cabfb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.txt @@ -0,0 +1,4 @@ +package + +public fun bar(/*0*/ resources: kotlin.collections.List): kotlin.Unit +public fun foo(/*0*/ resources: kotlin.collections.List): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt new file mode 100644 index 00000000000..16c6f507053 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt @@ -0,0 +1,49 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE + +import kotlin.reflect.KProperty +import kotlin.properties.ReadWriteProperty + +class CleanupTestExample { + val cleanUpBlocks: MutableList Unit>> = mutableListOf() + + class CleaningDelegate( + initialValue: T? = null, + val cleanupBlocks: MutableList Unit>>, + val block: (T) -> Unit + ) : ReadWriteProperty { + private var value: T? = initialValue + + init { + addCleanupBlock(initialValue) + } + + override fun getValue(thisRef: Any?, property: KProperty<*>): T { + return value ?: throw IllegalStateException("Property ${property.name} should be initialized before get.") + } + + @Suppress("UNCHECKED_CAST") + override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { + addCleanupBlock(value) + this.value = value + } + + fun addCleanupBlock(value: T?) { + if (value != null) { + @Suppress("UNCHECKED_CAST") + cleanupBlocks.add((value to block) as Pair Unit>) + } + + } + } + + data class TestHolder(val num: Int) + + fun cleanup(initialValue: T? = null, block: (T) -> Unit) = CleaningDelegate(initialValue, cleanUpBlocks, block) + + fun testWithCleanup() { + val testHolder = TestHolder(1) + + var thing: TestHolder by CleaningDelegate(testHolder, cleanupBlocks = cleanUpBlocks, block = { println("cleaning up $it") }) + var thing2: TestHolder by cleanup(testHolder) { println("cleaning up $it") } + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.txt new file mode 100644 index 00000000000..40a519cd39a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.txt @@ -0,0 +1,34 @@ +package + +public final class CleanupTestExample { + public constructor CleanupTestExample() + public final val cleanUpBlocks: kotlin.collections.MutableList kotlin.Unit>> + public final fun cleanup(/*0*/ initialValue: T? = ..., /*1*/ block: (T) -> kotlin.Unit): CleanupTestExample.CleaningDelegate + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun testWithCleanup(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class CleaningDelegate : kotlin.properties.ReadWriteProperty { + public constructor CleaningDelegate(/*0*/ initialValue: T? = ..., /*1*/ cleanupBlocks: kotlin.collections.MutableList kotlin.Unit>>, /*2*/ block: (T) -> kotlin.Unit) + public final val block: (T) -> kotlin.Unit + public final val cleanupBlocks: kotlin.collections.MutableList kotlin.Unit>> + private final var value: T? + public final fun addCleanupBlock(/*0*/ value: T?): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + @kotlin.Suppress(names = {"UNCHECKED_CAST"}) public open override /*1*/ fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>, /*2*/ value: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final data class TestHolder { + public constructor TestHolder(/*0*/ num: kotlin.Int) + public final val num: kotlin.Int + public final operator /*synthesized*/ fun component1(): kotlin.Int + public final /*synthesized*/ fun copy(/*0*/ num: kotlin.Int = ...): CleanupTestExample.TestHolder + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index df21d70027a..daf9f3f98cf 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -10321,6 +10321,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/inference/constraints/constraintOnFunctionLiteral.kt"); } + @TestMetadata("definitelyNotNullTypeInvariantPosition.kt") + public void testDefinitelyNotNullTypeInvariantPosition() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt"); + } + @TestMetadata("earlyCompletionForCalls.kt") public void testEarlyCompletionForCalls() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/earlyCompletionForCalls.kt"); @@ -10405,6 +10410,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { public void testSupertypeConstraintOnNullableType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/supertypeConstraintOnNullableType.kt"); } + + @TestMetadata("wrongApproximationWithDefNotNullTypesAndDelegates.kt") + public void testWrongApproximationWithDefNotNullTypesAndDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/inference/nestedCalls") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 0b96f39a618..8edcab4c5d6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -2731,11 +2731,21 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt"); } + @TestMetadata("kt27772.kt") + public void testKt27772() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt"); + } + @TestMetadata("kt30292.kt") public void testKt30292() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt30292.kt"); } + @TestMetadata("kt32345.kt") + public void testKt32345() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt"); + } + @TestMetadata("kt3458.kt") public void testKt3458() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt3458.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index d1a83bd2386..9a72281aec5 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -2731,11 +2731,21 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt"); } + @TestMetadata("kt27772.kt") + public void testKt27772() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt27772.kt"); + } + @TestMetadata("kt30292.kt") public void testKt30292() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt30292.kt"); } + @TestMetadata("kt32345.kt") + public void testKt32345() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt"); + } + @TestMetadata("kt3458.kt") public void testKt3458() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt3458.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index cf203898524..077f957e73d 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -10316,6 +10316,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inference/constraints/constraintOnFunctionLiteral.kt"); } + @TestMetadata("definitelyNotNullTypeInvariantPosition.kt") + public void testDefinitelyNotNullTypeInvariantPosition() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt"); + } + @TestMetadata("earlyCompletionForCalls.kt") public void testEarlyCompletionForCalls() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/earlyCompletionForCalls.kt"); @@ -10400,6 +10405,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing public void testSupertypeConstraintOnNullableType() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/constraints/supertypeConstraintOnNullableType.kt"); } + + @TestMetadata("wrongApproximationWithDefNotNullTypesAndDelegates.kt") + public void testWrongApproximationWithDefNotNullTypesAndDelegates() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/constraints/wrongApproximationWithDefNotNullTypesAndDelegates.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/inference/nestedCalls")