From d86be431718400e444a2f0d9274bae22a7593dbd Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 8 Jun 2016 16:15:01 +0300 Subject: [PATCH] Tests for type alias diagnostics: wrong number of type arguments in type alias constructor --- ...NumberOfArgumentsInTypeAliasConstructor.kt | 23 ++++++++++++++++ ...umberOfArgumentsInTypeAliasConstructor.txt | 27 +++++++++++++++++++ .../checkers/DiagnosticsTestGenerated.java | 6 +++++ 3 files changed, 56 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt create mode 100644 compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.txt diff --git a/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt b/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt new file mode 100644 index 00000000000..8ca744b73af --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt @@ -0,0 +1,23 @@ +class Pair(val x1: T1, val x2: T2) + +typealias P = Pair + +typealias P2 = Pair + +typealias PR = Pair + +val test0 = P(1, 2) +val test1 = P(1, 2) +val test2 = P(1, 2) +val test3 = P(1, 2) + +val test0p2 = P2(1, 1) +val test1p2 = P2(1, 1) +val test2p2 = P2(1, 1) +val test3p2 = P2(1, 1) + +val test0pr = PR(1, "") +val test1pr = PR(1, "") +val test2pr = PR(1, "") +val test2pra = PR(1, "") +val test3pr = P2(1, "") diff --git a/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.txt b/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.txt new file mode 100644 index 00000000000..7b8c401924a --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.txt @@ -0,0 +1,27 @@ +package + +public typealias P = Pair +public typealias P2 = Pair +public typealias PR = Pair +public val test0: Pair +public val test0p2: Pair +public val test0pr: Pair +public val test1: Pair +public val test1p2: Pair +public val test1pr: Pair<[ERROR : Explicit type argument expected for T2], kotlin.Int> +public val test2: Pair +public val test2p2: Pair +public val test2pr: Pair +public val test2pra: Pair +public val test3: Pair +public val test3p2: Pair +public val test3pr: Pair + +public final class Pair { + public constructor Pair(/*0*/ x1: T1, /*1*/ x2: T2) + public final val x1: T1 + public final val x2: T2 + 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/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index b9e7b027aca..d37f3fd8615 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -19580,6 +19580,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/unsupportedTypeAlias.kt"); doTest(fileName); } + + @TestMetadata("wrongNumberOfArgumentsInTypeAliasConstructor.kt") + public void testWrongNumberOfArgumentsInTypeAliasConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/diagnostics/tests/unit")