From 7ba4adf006ff8c79ee213bfdbe024420c3c30f18 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Tue, 16 Feb 2016 15:43:58 +0300 Subject: [PATCH] Add tests for diagnostics rendering --- .../complexTypeMismatchWithTypeParameters.kt | 16 ++++++++++++++++ .../complexTypeMismatchWithTypeParameters1.html | 14 ++++++++++++++ .../typeMismatchWithTypeParameters.kt | 15 +++++++++++++++ .../typeMismatchWithTypeParameters1.txt | 2 ++ .../DiagnosticMessageTestGenerated.java | 12 ++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt create mode 100644 idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters1.html create mode 100644 idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt create mode 100644 idea/testData/diagnosticMessage/typeMismatchWithTypeParameters1.txt diff --git a/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt b/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt new file mode 100644 index 00000000000..112aacfa080 --- /dev/null +++ b/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt @@ -0,0 +1,16 @@ +// !DIAGNOSTICS_NUMBER: 1 +// !DIAGNOSTICS: TYPE_MISMATCH +// !MESSAGE_TYPE: HTML + +package a.b.c + +class G + +class D { + fun f(t: Map) { + } + + fun f(t1: Map, T2: T) { + f(t1) + } +} \ No newline at end of file diff --git a/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters1.html b/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters1.html new file mode 100644 index 00000000000..26a84203422 --- /dev/null +++ b/idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters1.html @@ -0,0 +1,14 @@ + + +Type mismatch. + + + + + + + + + +
Required:Map<`T#1 (type parameter of a.b.c.D), a.b.c.G>
Found:Map<`T#2 (type parameter of a.b.c.D.f), G#1 (type parameter of a.b.c.D)>
+ \ No newline at end of file diff --git a/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt b/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt new file mode 100644 index 00000000000..ba76feac6c1 --- /dev/null +++ b/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt @@ -0,0 +1,15 @@ +// !DIAGNOSTICS_NUMBER: 1 +// !DIAGNOSTICS: TYPE_MISMATCH +// !MESSAGE_TYPE: TEXT + +package myPackage.a.b + +class A { + fun g(t: T) { + + } + + fun f(t: T) { + g(t) + } +} \ No newline at end of file diff --git a/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters1.txt b/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters1.txt new file mode 100644 index 00000000000..281d17483a9 --- /dev/null +++ b/idea/testData/diagnosticMessage/typeMismatchWithTypeParameters1.txt @@ -0,0 +1,2 @@ + +Type mismatch: inferred type is T#2 (type parameter of myPackage.a.b.A.f) but T#1 (type parameter of myPackage.a.b.A) was expected \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java index f96e4fe4986..0e470918100 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java @@ -65,6 +65,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes doTest(fileName); } + @TestMetadata("complexTypeMismatchWithTypeParameters.kt") + public void testComplexTypeMismatchWithTypeParameters() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt"); + doTest(fileName); + } + @TestMetadata("conflictingOverloadsClass.kt") public void testConflictingOverloadsClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/conflictingOverloadsClass.kt"); @@ -215,6 +221,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes doTest(fileName); } + @TestMetadata("typeMismatchWithTypeParameters.kt") + public void testTypeMismatchWithTypeParameters() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt"); + doTest(fileName); + } + @TestMetadata("typeParameterAsReified.kt") public void testTypeParameterAsReified() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeParameterAsReified.kt");