diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.kt new file mode 100644 index 00000000000..6f8e7b4aa85 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.kt @@ -0,0 +1,9 @@ +class A { + val x = arrayListOf<(A<>) -> Unit>() + + // Here we got an exception during type comparison + fun foo(){ + x.add {} + } + +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.txt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.txt new file mode 100644 index 00000000000..89a58c4f91d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.txt @@ -0,0 +1,10 @@ +package + +internal final class A { + public constructor A() + internal final val x: java.util.ArrayList<([ERROR : A]<[ERROR : No type element]>) -> kotlin.Unit> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java index 1c81825c76e..d42fea42f26 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java @@ -603,6 +603,12 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/regression/ea63992.kt"); doTest(fileName); } + + @TestMetadata("ea65206.kt") + public void testEa65206() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/regression/ea65206.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/reified") diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/checker/TypeCheckingProcedure.java b/core/descriptors/src/org/jetbrains/kotlin/types/checker/TypeCheckingProcedure.java index 96959eae9ab..f017d890f14 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/checker/TypeCheckingProcedure.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/checker/TypeCheckingProcedure.java @@ -70,6 +70,7 @@ public class TypeCheckingProcedure { } public boolean equalTypes(@NotNull JetType type1, @NotNull JetType type2) { + if (type1 == type2) return true; if (TypesPackage.isFlexible(type1)) { if (TypesPackage.isFlexible(type2)) { return !type1.isError() && !type2.isError() && isSubtypeOf(type1, type2) && isSubtypeOf(type2, type1);