From a979960e63481431a22b3fe02631a2099a047d4f Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 30 Nov 2022 12:28:43 +0200 Subject: [PATCH] [FE 1.0] Add test for KT-45970 --- ...CompilerTestFE10TestdataTestGenerated.java | 6 ++ ...irOldFrontendDiagnosticsTestGenerated.java | 6 ++ ...DiagnosticsWithLightTreeTestGenerated.java | 6 ++ .../diagnostics/tests/numbers/kt45970.fir.kt | 59 +++++++++++++++++++ .../diagnostics/tests/numbers/kt45970.kt | 59 +++++++++++++++++++ .../diagnostics/tests/numbers/kt45970.txt | 43 ++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 ++ 7 files changed, 185 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/numbers/kt45970.fir.kt create mode 100644 compiler/testData/diagnostics/tests/numbers/kt45970.kt create mode 100644 compiler/testData/diagnostics/tests/numbers/kt45970.txt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index a4006e9c0e2..aea0ef7918d 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -22266,6 +22266,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/numbers/kt41679.kt"); } + @Test + @TestMetadata("kt45970.kt") + public void testKt45970() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt45970.kt"); + } + @Test @TestMetadata("kt47447.kt") public void testKt47447() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 9b93fdde65a..743dada2515 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -22272,6 +22272,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/numbers/kt41679.kt"); } + @Test + @TestMetadata("kt45970.kt") + public void testKt45970() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt45970.kt"); + } + @Test @TestMetadata("kt47447.kt") public void testKt47447() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 0418441e188..408e3a671a7 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -22266,6 +22266,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/numbers/kt41679.kt"); } + @Test + @TestMetadata("kt45970.kt") + public void testKt45970() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt45970.kt"); + } + @Test @TestMetadata("kt47447.kt") public void testKt47447() throws Exception { diff --git a/compiler/testData/diagnostics/tests/numbers/kt45970.fir.kt b/compiler/testData/diagnostics/tests/numbers/kt45970.fir.kt new file mode 100644 index 00000000000..306f7eb37ad --- /dev/null +++ b/compiler/testData/diagnostics/tests/numbers/kt45970.fir.kt @@ -0,0 +1,59 @@ +// ISSUE: KT-45970 + +val a_1: Byte = 1 +var a_2: Byte = 1 +val b_1: Short = 1 +var b_2: Short = 1 +val c_1: Int = 1 +var c_2: Int = 1 +val d_1: Long = 1 +var d_2: Long = 1 + +val e_1: Byte = 1 + 2 +var e_2: Byte = 1 + 2 +val f_1: Short = 1 + 2 +var f_2: Short = 1 + 2 +val g_1: Int = 1 + 2 +var g_2: Int = 1 + 2 +val h_1: Long = 1 + 2 +var h_2: Long = 1 + 2 + +fun local() { + val a_1: Byte = 1 + var a_2: Byte = 1 + val b_1: Short = 1 + var b_2: Short = 1 + val c_1: Int = 1 + var c_2: Int = 1 + val d_1: Long = 1 + var d_2: Long = 1 + + val e_1: Byte = 1 + 2 + var e_2: Byte = 1 + 2 + val f_1: Short = 1 + 2 + var f_2: Short = 1 + 2 + val g_1: Int = 1 + 2 + var g_2: Int = 1 + 2 + val h_1: Long = 1 + 2 + var h_2: Long = 1 + 2 +} + +class Member { + val a_1: Byte = 1 + var a_2: Byte = 1 + val b_1: Short = 1 + var b_2: Short = 1 + val c_1: Int = 1 + var c_2: Int = 1 + val d_1: Long = 1 + var d_2: Long = 1 + + val e_1: Byte = 1 + 2 + var e_2: Byte = 1 + 2 + val f_1: Short = 1 + 2 + var f_2: Short = 1 + 2 + val g_1: Int = 1 + 2 + var g_2: Int = 1 + 2 + val h_1: Long = 1 + 2 + var h_2: Long = 1 + 2 +} diff --git a/compiler/testData/diagnostics/tests/numbers/kt45970.kt b/compiler/testData/diagnostics/tests/numbers/kt45970.kt new file mode 100644 index 00000000000..e3e1aa7418e --- /dev/null +++ b/compiler/testData/diagnostics/tests/numbers/kt45970.kt @@ -0,0 +1,59 @@ +// ISSUE: KT-45970 + +val a_1: Byte = 1 +var a_2: Byte = 1 +val b_1: Short = 1 +var b_2: Short = 1 +val c_1: Int = 1 +var c_2: Int = 1 +val d_1: Long = 1 +var d_2: Long = 1 + +val e_1: Byte = 1 + 2 +var e_2: Byte = 1 + 2 +val f_1: Short = 1 + 2 +var f_2: Short = 1 + 2 +val g_1: Int = 1 + 2 +var g_2: Int = 1 + 2 +val h_1: Long = 1 + 2 +var h_2: Long = 1 + 2 + +fun local() { + val a_1: Byte = 1 + var a_2: Byte = 1 + val b_1: Short = 1 + var b_2: Short = 1 + val c_1: Int = 1 + var c_2: Int = 1 + val d_1: Long = 1 + var d_2: Long = 1 + + val e_1: Byte = 1 + 2 + var e_2: Byte = 1 + 2 + val f_1: Short = 1 + 2 + var f_2: Short = 1 + 2 + val g_1: Int = 1 + 2 + var g_2: Int = 1 + 2 + val h_1: Long = 1 + 2 + var h_2: Long = 1 + 2 +} + +class Member { + val a_1: Byte = 1 + var a_2: Byte = 1 + val b_1: Short = 1 + var b_2: Short = 1 + val c_1: Int = 1 + var c_2: Int = 1 + val d_1: Long = 1 + var d_2: Long = 1 + + val e_1: Byte = 1 + 2 + var e_2: Byte = 1 + 2 + val f_1: Short = 1 + 2 + var f_2: Short = 1 + 2 + val g_1: Int = 1 + 2 + var g_2: Int = 1 + 2 + val h_1: Long = 1 + 2 + var h_2: Long = 1 + 2 +} diff --git a/compiler/testData/diagnostics/tests/numbers/kt45970.txt b/compiler/testData/diagnostics/tests/numbers/kt45970.txt new file mode 100644 index 00000000000..201aa17bcaf --- /dev/null +++ b/compiler/testData/diagnostics/tests/numbers/kt45970.txt @@ -0,0 +1,43 @@ +package + +public val a_1: kotlin.Byte = 1.toByte() +public var a_2: kotlin.Byte +public val b_1: kotlin.Short = 1.toShort() +public var b_2: kotlin.Short +public val c_1: kotlin.Int = 1 +public var c_2: kotlin.Int +public val d_1: kotlin.Long = 1.toLong() +public var d_2: kotlin.Long +public val e_1: kotlin.Byte = 3.toByte() +public var e_2: kotlin.Byte +public val f_1: kotlin.Short = 3.toShort() +public var f_2: kotlin.Short +public val g_1: kotlin.Int = 3 +public var g_2: kotlin.Int +public val h_1: kotlin.Long = 3.toLong() +public var h_2: kotlin.Long +public fun local(): kotlin.Unit + +public final class Member { + public constructor Member() + public final val a_1: kotlin.Byte = 1.toByte() + public final var a_2: kotlin.Byte + public final val b_1: kotlin.Short = 1.toShort() + public final var b_2: kotlin.Short + public final val c_1: kotlin.Int = 1 + public final var c_2: kotlin.Int + public final val d_1: kotlin.Long = 1.toLong() + public final var d_2: kotlin.Long + public final val e_1: kotlin.Byte = 3.toByte() + public final var e_2: kotlin.Byte + public final val f_1: kotlin.Short = 3.toShort() + public final var f_2: kotlin.Short + public final val g_1: kotlin.Int = 3 + public final var g_2: kotlin.Int + public final val h_1: kotlin.Long = 3.toLong() + public final var h_2: kotlin.Long + 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-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 007f2957866..a272530a1c6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -22272,6 +22272,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/numbers/kt41679.kt"); } + @Test + @TestMetadata("kt45970.kt") + public void testKt45970() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt45970.kt"); + } + @Test @TestMetadata("kt47447.kt") public void testKt47447() throws Exception {