[FIR] Freeze the current behavior of ImplicitIntegerCoercion+overloads

Adding the tests "just in case", ensuring the
K2 behaves similar to K1.
This commit is contained in:
Nikolay Lunyak
2023-04-24 15:14:51 +03:00
committed by Space Team
parent 931894ab3c
commit f3ca465647
7 changed files with 80 additions and 0 deletions
@@ -33997,6 +33997,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt");
}
@Test
@TestMetadata("implicitIntegerCoercionOverloading.kt")
public void testImplicitIntegerCoercionOverloading() throws Exception {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.kt");
}
@Test
@TestMetadata("inferenceForSignedAndUnsignedTypes.kt")
public void testInferenceForSignedAndUnsignedTypes() throws Exception {
@@ -33997,6 +33997,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt");
}
@Test
@TestMetadata("implicitIntegerCoercionOverloading.kt")
public void testImplicitIntegerCoercionOverloading() throws Exception {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.kt");
}
@Test
@TestMetadata("inferenceForSignedAndUnsignedTypes.kt")
public void testInferenceForSignedAndUnsignedTypes() throws Exception {
@@ -33997,6 +33997,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt");
}
@Test
@TestMetadata("implicitIntegerCoercionOverloading.kt")
public void testImplicitIntegerCoercionOverloading() throws Exception {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.kt");
}
@Test
@TestMetadata("inferenceForSignedAndUnsignedTypes.kt")
public void testInferenceForSignedAndUnsignedTypes() throws Exception {
@@ -34093,6 +34093,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt");
}
@Test
@TestMetadata("implicitIntegerCoercionOverloading.kt")
public void testImplicitIntegerCoercionOverloading() throws Exception {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.kt");
}
@Test
@TestMetadata("inferenceForSignedAndUnsignedTypes.kt")
public void testInferenceForSignedAndUnsignedTypes() throws Exception {
@@ -0,0 +1,25 @@
// ISSUE: KT-57655
// !LANGUAGE: +ImplicitSignedToUnsignedIntegerConversion
// ALLOW_KOTLIN_PACKAGE
// FILE: annotation.kt
package kotlin.internal
annotation class ImplicitIntegerCoercion
// FILE: test.kt
import kotlin.internal.ImplicitIntegerCoercion
fun test(@ImplicitIntegerCoercion x: UInt) = x
fun test(@ImplicitIntegerCoercion x: ULong) = x
fun testLong(@ImplicitIntegerCoercion x: ULong) = x
fun box(): String = when {
test(5) != 5.toUInt() -> "Fail: test(5)"
<!NONE_APPLICABLE!>test<!>(5L) != 5L.toULong() -> "Fail: test(5L)"
testLong(5) != 5L.toULong() -> "Fail: test(5L)"
testLong(<!ARGUMENT_TYPE_MISMATCH!>5L<!>) != 5L.toULong() -> "Fail: test(5L)"
else -> "OK"
}
@@ -0,0 +1,25 @@
// ISSUE: KT-57655
// !LANGUAGE: +ImplicitSignedToUnsignedIntegerConversion
// ALLOW_KOTLIN_PACKAGE
// FILE: annotation.kt
package kotlin.internal
annotation class ImplicitIntegerCoercion
// FILE: test.kt
import kotlin.internal.ImplicitIntegerCoercion
fun test(@ImplicitIntegerCoercion x: UInt) = x
fun test(@ImplicitIntegerCoercion x: ULong) = x
fun testLong(@ImplicitIntegerCoercion x: ULong) = x
fun box(): String = when {
test(5) != 5.toUInt() -> "Fail: test(5)"
<!EQUALITY_NOT_APPLICABLE!>test(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>5L<!>) != 5L.toULong()<!> -> "Fail: test(5L)"
testLong(5) != 5L.toULong() -> "Fail: test(5L)"
testLong(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>5L<!>) != 5L.toULong() -> "Fail: test(5L)"
else -> "OK"
}
@@ -34865,6 +34865,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt");
}
@Test
@TestMetadata("implicitIntegerCoercionOverloading.kt")
public void testImplicitIntegerCoercionOverloading() throws Exception {
runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.kt");
}
@Test
@TestMetadata("inferenceForSignedAndUnsignedTypes.kt")
public void testInferenceForSignedAndUnsignedTypes() throws Exception {