From 5ad4c8b9c70c3d02aa0df04ffbaaed7f003b907f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 9 Jun 2016 12:17:54 +0300 Subject: [PATCH] Redeclaration errors for type aliases: type alias vs property. --- .../tests/redeclarations/TypeAliasVsProperty.kt | 15 +++++++++++++++ .../tests/redeclarations/TypeAliasVsProperty.txt | 15 +++++++++++++++ .../kotlin/checkers/DiagnosticsTestGenerated.java | 6 ++++++ 3 files changed, 36 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.kt create mode 100644 compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.txt diff --git a/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.kt b/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.kt new file mode 100644 index 00000000000..8ec4cbb1da4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.kt @@ -0,0 +1,15 @@ +// FILE: file1.kt +typealias Test = String + +val Test = 42 + +class Outer { + typealias Test = String + + val Test = 42 +} + +typealias Test2 = String + +// FILE: file2.kt +val Test2 = 42 diff --git a/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.txt b/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.txt new file mode 100644 index 00000000000..1caf40639c4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.txt @@ -0,0 +1,15 @@ +package + +public typealias Test = kotlin.String +public typealias Test2 = kotlin.String +public val Test: kotlin.Int = 42 +public val Test2: kotlin.Int = 42 + +public final class Outer { + public typealias Test = kotlin.String + public constructor Outer() + public final val Test: kotlin.Int = 42 + 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 544e51b5dad..7eb0a43fdca 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -13908,6 +13908,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("TypeAliasVsProperty.kt") + public void testTypeAliasVsProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/TypeAliasVsProperty.kt"); + doTest(fileName); + } + @TestMetadata("typeParameterWithTwoBounds.kt") public void testTypeParameterWithTwoBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/typeParameterWithTwoBounds.kt");