FE: add new tests around unresolved integer literals
Related to KT-57487, KT-57703
This commit is contained in:
committed by
Space Team
parent
70c5978add
commit
27c4a7b7ef
+6
@@ -19253,6 +19253,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
public void testTypealiasOnLong() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -19253,6 +19253,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
public void testTypealiasOnLong() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -19253,6 +19253,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
public void testTypealiasOnLong() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -19259,6 +19259,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
public void testTypealiasOnLong() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -18572,6 +18572,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/unqualifiedEnum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -18572,6 +18572,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/unqualifiedEnum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_K1: JVM_IR
|
||||
// (type mismatch)
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// (CCE in select)
|
||||
// WITH_STDLIB
|
||||
|
||||
fun <A : Comparable<A>> arrayData(vararg values: A): A = values.first()
|
||||
|
||||
fun test(b: Byte) = select(arrayData(1), b)
|
||||
|
||||
fun <S : Comparable<S>> select(a: S, b: S): S {
|
||||
if (a.compareTo(b) > 0) return a else return b
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val res = test(-42)
|
||||
val res2 = res.dec()
|
||||
res.doSomething()
|
||||
if (res == 1.toByte() && res2 == 0.toByte()) return "OK" else return res.toString()
|
||||
}
|
||||
|
||||
fun Byte.doSomething() {}
|
||||
@@ -0,0 +1,17 @@
|
||||
// FIR_DUMP
|
||||
|
||||
fun <A : Comparable<A>> arrayData(vararg values: A): A = null!!
|
||||
|
||||
fun <A> arrayDataNoBound(vararg values: A): A = null!!
|
||||
|
||||
fun test(b: Byte) {
|
||||
select(arrayData(1), b)
|
||||
select(id(1), b)
|
||||
select(id(arrayData(1)), b)
|
||||
select(arrayDataNoBound(1), b)
|
||||
}
|
||||
|
||||
fun <S> select(a: S, b: S) = a
|
||||
|
||||
fun <I : Comparable<I>> id(arg: I) = arg
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
FILE: vararg.fir.kt
|
||||
public final fun <A : R|kotlin/Comparable<A>|> arrayData(vararg values: R|kotlin/Array<out A>|): R|A| {
|
||||
^arrayData Null(null)!!
|
||||
}
|
||||
public final fun <A> arrayDataNoBound(vararg values: R|kotlin/Array<out A>|): R|A| {
|
||||
^arrayDataNoBound Null(null)!!
|
||||
}
|
||||
public final fun test(b: R|kotlin/Byte|): R|kotlin/Unit| {
|
||||
R|/select|<R|kotlin/Byte|>(R|/arrayData|<R|kotlin/Int|>(vararg(Int(1))), R|<local>/b|)
|
||||
R|/select|<R|kotlin/Byte|>(R|/id|<R|kotlin/Int|>(Int(1)), R|<local>/b|)
|
||||
R|/select|<R|kotlin/Byte|>(R|/id|<R|kotlin/Int|>(R|/arrayData|<R|kotlin/Int|>(vararg(Int(1)))), R|<local>/b|)
|
||||
R|/select|<R|kotlin/Byte|>(R|/arrayDataNoBound|<R|kotlin/Byte|>(vararg(Byte(1))), R|<local>/b|)
|
||||
}
|
||||
public final fun <S> select(a: R|S|, b: R|S|): R|S| {
|
||||
^select R|<local>/a|
|
||||
}
|
||||
public final fun <I : R|kotlin/Comparable<I>|> id(arg: R|I|): R|I| {
|
||||
^id R|<local>/arg|
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// FIR_DUMP
|
||||
|
||||
fun <A : Comparable<A>> arrayData(vararg values: A): A = null!!
|
||||
|
||||
fun <A> arrayDataNoBound(vararg values: A): A = null!!
|
||||
|
||||
fun test(b: Byte) {
|
||||
select(<!TYPE_MISMATCH!>arrayData(1)<!>, b)
|
||||
select(<!TYPE_MISMATCH!>id(1)<!>, b)
|
||||
select(<!TYPE_MISMATCH!>id(arrayData(1))<!>, b)
|
||||
select(arrayDataNoBound(1), b)
|
||||
}
|
||||
|
||||
fun <S> select(a: S, b: S) = a
|
||||
|
||||
fun <I : Comparable<I>> id(arg: I) = arg
|
||||
Generated
+6
@@ -19259,6 +19259,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
public void testTypealiasOnLong() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -18572,6 +18572,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/unqualifiedEnum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -18572,6 +18572,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/unqualifiedEnum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user