[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:
committed by
Space Team
parent
931894ab3c
commit
f3ca465647
+25
@@ -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"
|
||||
}
|
||||
Vendored
+25
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user