From f54653eb2bfe1a64f7262dd16fb1db5732657565 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 17 May 2019 14:44:28 +0300 Subject: [PATCH] [NI] Fix error type approximation in ILTApproximatorConfiguration #KT-31441 Fixed --- .../src/org/jetbrains/kotlin/types/TypeApproximator.kt | 2 ++ .../intentions/removeExplicitTypeArguments/kt31441.kt | 10 ++++++++++ .../kotlin/idea/intentions/IntentionTestGenerated.java | 5 +++++ 3 files changed, 17 insertions(+) create mode 100644 idea/testData/intentions/removeExplicitTypeArguments/kt31441.kt diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index dc9a69b5f3d..59e8b4f80b2 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -96,6 +96,8 @@ open class TypeApproximatorConfiguration { override val allFlexible: Boolean get() = true override val intersection get() = ALLOWED override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true } + override val errorType: Boolean get() = true + override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean = true } } diff --git a/idea/testData/intentions/removeExplicitTypeArguments/kt31441.kt b/idea/testData/intentions/removeExplicitTypeArguments/kt31441.kt new file mode 100644 index 00000000000..826f201ebcb --- /dev/null +++ b/idea/testData/intentions/removeExplicitTypeArguments/kt31441.kt @@ -0,0 +1,10 @@ +// COMPILER_ARGUMENTS: -XXLanguage:+NewInference +// IS_APPLICABLE: false + +interface List + +class ArrayList : List + +fun test() { + val list: List<*> = ArrayList() +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index f54cc22194e..54387155385 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -14624,6 +14624,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest { runTest("idea/testData/intentions/removeExplicitTypeArguments/insideOtherCall.kt"); } + @TestMetadata("kt31441.kt") + public void testKt31441() throws Exception { + runTest("idea/testData/intentions/removeExplicitTypeArguments/kt31441.kt"); + } + @TestMetadata("lambdaType.kt") public void testLambdaType() throws Exception { runTest("idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt");