diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.kt new file mode 100644 index 00000000000..fe4f8812f82 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.kt @@ -0,0 +1,21 @@ +class Pair(val x: X, val y: Y) + +class C { + typealias P = Pair + typealias P1 = Pair + typealias P2 = Pair +} + +// C<...>.P[<...>]() syntax doesn't work due to the way qualified expressions are resolved now. +// This restriction can be removed later. +val test0 = C.P(1, 1) +val test1 = C.P1("", 1) +val test2 = C.P2(1, "") +val test3 = C.P1("", 1) +val test4 = C.P2(1, "") + +// C.P() syntax could work if we add captured type parameters as type variables in a constraint system for corresponding call. +// However, this should be consistent with inner classes capturing type parameters. +val test5 = C.P(1, 1) +val test6 = C.P1("", 1) +val test7 = C.P2(1, "") diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.txt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.txt new file mode 100644 index 00000000000..01e86ef3e8e --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.txt @@ -0,0 +1,29 @@ +package + +public val test0: [ERROR : Type for C.P(1, 1)] +public val test1: [ERROR : Type for C.P1("", 1)] +public val test2: [ERROR : Type for C.P2(1, "")] +public val test3: [ERROR : Type for C.P1("", 1)] +public val test4: [ERROR : Type for C.P2(1, "")] +public val test5: Pair +public val test6: Pair +public val test7: Pair + +public final class C { + public constructor C() + 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 + public typealias P /*captured type parameters: /*0*/ T*/ = Pair + public typealias P1 /*captured type parameters: /*1*/ T*/ = Pair + public typealias P2 /*captured type parameters: /*1*/ T*/ = Pair +} + +public final class Pair { + public constructor Pair(/*0*/ x: X, /*1*/ y: Y) + public final val x: X + public final val y: Y + 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 dd1a0465973..bca2fb1f626 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20938,6 +20938,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("innerTypeAliasConstructor.kt") + public void testInnerTypeAliasConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/innerTypeAliasConstructor.kt"); + doTest(fileName); + } + @TestMetadata("isAsWithTypeAlias.kt") public void testIsAsWithTypeAlias() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/isAsWithTypeAlias.kt");