[FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1 (because of not fully correct implementation) and unconditionally enabled in K2 (K2 does not support old behavior) ^KT-38895
This commit is contained in:
committed by
Space Team
parent
26ff806440
commit
3cffb33ab7
@@ -1,4 +1,4 @@
|
||||
$TESTDATA_DIR$/overridingXx.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-XXLanguage\:+ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
-XXLanguage\:+RangeUntilOperator
|
||||
|
||||
@@ -1 +1 @@
|
||||
-XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
-XXLanguage:-RangeUntilOperator
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
|
||||
|
||||
const val cacheSize: Long = 4096 * 4
|
||||
fun test(): Int {
|
||||
var res = 0
|
||||
for (x in 100 ..< 1) {
|
||||
res += x
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
warning: ATTENTION!
|
||||
This build uses unsafe internal compiler arguments:
|
||||
|
||||
-XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
-XXLanguage:-RangeUntilOperator
|
||||
|
||||
This mode is not recommended for production use,
|
||||
as no stability/compatibility guarantees are given on
|
||||
compiler or generated code. Use it at your own risk!
|
||||
|
||||
compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:1:9: warning: parameter 'ttlMillis' is never used
|
||||
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
|
||||
^
|
||||
OK
|
||||
compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:3:19: error: this declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
|
||||
for (x in 100 ..< 1) {
|
||||
^
|
||||
compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:3:19: error: the feature "range until operator" is disabled
|
||||
for (x in 100 ..< 1) {
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// WITH_STDLIB
|
||||
// This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321).
|
||||
// Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895).
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte = 1.plus(1)
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1.plus(1)
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte = 1 + 1
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1 + 1
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
|
||||
fun box(): String {
|
||||
val a: Long = 2147483647 + 1
|
||||
if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_FIR_DIAGNOSTICS
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_FIR_DIAGNOSTICS
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_FIR_DIAGNOSTICS
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_FIR_DIAGNOSTICS
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_STDLIB
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte = 1.unaryMinus()
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1.unaryMinus()
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
@@ -65,4 +64,4 @@ fun box(): String {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
@@ -62,4 +61,4 @@ fun box(): String {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// For reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
val a: Byte = 1 + 10
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// For reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
val a: Short = 1 + 255
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(<!MISSING_VAL_ON_ANNOTATION_PARAMETER!>p1: Int<!>,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(<!MISSING_VAL_ON_ANNOTATION_PARAMETER!>p1: Int<!>,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
package test
|
||||
|
||||
annotation class Ann(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses
|
||||
// SKIP_JAVAC
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses
|
||||
// SKIP_JAVAC
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
fun fooInt(p: Int) = p
|
||||
fun fooLong(p: Long) = p
|
||||
fun fooByte(p: Byte) = p
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
val p1: Byte = <!TYPE_MISMATCH!>(1 + 2) * 2<!>
|
||||
val p2: Short = <!TYPE_MISMATCH!>(1 + 2) * 2<!>
|
||||
val p3: Int = (1 + 2) * 2
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
val p1: Byte = <!TYPE_MISMATCH!>(1 + 2) * 2<!>
|
||||
val p2: Short = <!TYPE_MISMATCH!>(1 + 2) * 2<!>
|
||||
val p1: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>(1 + 2) * 2<!>
|
||||
val p2: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>(1 + 2) * 2<!>
|
||||
val p3: Int = (1 + 2) * 2
|
||||
val p4: Long = <!TYPE_MISMATCH!>(1 + 2) * 2<!>
|
||||
val p4: Long = (1 + 2) * 2
|
||||
|
||||
val b1: Byte = <!TYPE_MISMATCH!>(1.toByte() + 2) * 2<!>
|
||||
val b2: Short = <!TYPE_MISMATCH!>(1.toShort() + 2) * 2<!>
|
||||
val b1: Byte = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE, TYPE_MISMATCH!>(1.toByte() + 2) * 2<!>
|
||||
val b2: Short = <!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE, TYPE_MISMATCH!>(1.toShort() + 2) * 2<!>
|
||||
val b3: Int = (1.toInt() + 2) * 2
|
||||
val b4: Long = (1.toLong() + 2) * 2
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ public val b3: kotlin.Int = 6
|
||||
public val b4: kotlin.Long = 6.toLong()
|
||||
public val i1: kotlin.Int = 6
|
||||
public val i2: kotlin.Int = 6
|
||||
public val p1: kotlin.Byte = 6
|
||||
public val p2: kotlin.Short = 6
|
||||
public val p1: kotlin.Byte = 6.toByte()
|
||||
public val p2: kotlin.Short = 6.toShort()
|
||||
public val p3: kotlin.Int = 6
|
||||
public val p4: kotlin.Long = 6
|
||||
public val p4: kotlin.Long = 6.toLong()
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// ISSUE: KT-47447
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// ISSUE: Kt-47447, KT-47729
|
||||
|
||||
fun takeLong(value : Long) {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// ISSUE: Kt-47447, KT-47729
|
||||
|
||||
fun takeLong(x: Long) {}
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
|
||||
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
|
||||
fun foo(ttlMillis: Long = 5 * 60 * 1000) {}
|
||||
|
||||
const val cacheSize: Long = 4096 * 4
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
|
||||
fun foo(ttlMillis: Long = <!TYPE_MISMATCH!>5 * 60 * 1000<!>) {}
|
||||
|
||||
const val cacheSize: Long = <!TYPE_MISMATCH!>4096 * 4<!>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package
|
||||
|
||||
public const val cacheSize: kotlin.Long = 16384
|
||||
public fun foo(/*0*/ ttlMillis: kotlin.Long = ...): kotlin.Unit
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321).
|
||||
// Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895).
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321).
|
||||
// Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895).
|
||||
|
||||
|
||||
Vendored
-116
@@ -1,116 +0,0 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-38895
|
||||
|
||||
fun takeByte(b: Byte) {}
|
||||
fun takeInt(b: Int) {}
|
||||
fun takeLong(b: Long) {}
|
||||
|
||||
fun testByteBinaryOperators() {
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 + 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 - 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 * 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 / 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 % 1<!>)
|
||||
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.plus(1)<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.minus(1)<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.times(1)<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.div(1)<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.rem(1)<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 shl 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 shr 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 ushr 1<!>)
|
||||
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 and 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 or 1<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2 xor 1<!>)
|
||||
}
|
||||
|
||||
fun testByteUnaryOperators() {
|
||||
// No mismatch
|
||||
takeByte(+1)
|
||||
takeByte(-1)
|
||||
|
||||
// Mismatch
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.unaryPlus()<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.unaryMinus()<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>2.inv()<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>1.inc()<!>)
|
||||
takeByte(<!ARGUMENT_TYPE_MISMATCH!>1.dec()<!>)
|
||||
}
|
||||
|
||||
fun testLongBinaryOperators() {
|
||||
takeLong(2 + 1)
|
||||
takeLong(2 - 1)
|
||||
takeLong(2 * 1)
|
||||
takeLong(2 / 1)
|
||||
takeLong(2 % 1)
|
||||
|
||||
takeLong(2.plus(1))
|
||||
takeLong(2.minus(1))
|
||||
takeLong(2.times(1))
|
||||
takeLong(2.div(1))
|
||||
takeLong(2.rem(1))
|
||||
takeLong(2 shl 1)
|
||||
takeLong(2 shr 1)
|
||||
takeLong(2 ushr 1)
|
||||
|
||||
takeLong(2 and 1)
|
||||
takeLong(2 or 1)
|
||||
takeLong(2 xor 1)
|
||||
|
||||
// positive
|
||||
takeLong(2 * 100000000000)
|
||||
}
|
||||
|
||||
fun testLongUnaryOperators() {
|
||||
// No mismatch
|
||||
takeLong(+1)
|
||||
takeLong(-1)
|
||||
|
||||
// Mismatch
|
||||
takeLong(2.unaryPlus())
|
||||
takeLong(2.unaryMinus())
|
||||
takeLong(2.inv())
|
||||
takeLong(<!ARGUMENT_TYPE_MISMATCH!>1.inc()<!>)
|
||||
takeLong(<!ARGUMENT_TYPE_MISMATCH!>1.dec()<!>)
|
||||
}
|
||||
|
||||
fun testIntBinaryOperators() {
|
||||
takeInt(2 + 1)
|
||||
takeInt(2 - 1)
|
||||
takeInt(2 * 1)
|
||||
takeInt(2 / 1)
|
||||
takeInt(2 % 1)
|
||||
|
||||
takeInt(2.plus(1))
|
||||
takeInt(2.minus(1))
|
||||
takeInt(2.times(1))
|
||||
takeInt(2.div(1))
|
||||
takeInt(2.rem(1))
|
||||
takeInt(2 shl 1)
|
||||
takeInt(2 shr 1)
|
||||
takeInt(2 ushr 1)
|
||||
|
||||
takeInt(2 and 1)
|
||||
takeInt(2 or 1)
|
||||
takeInt(2 xor 1)
|
||||
}
|
||||
|
||||
fun testIntUnaryOperators() {
|
||||
takeInt(+1)
|
||||
takeInt(-1)
|
||||
|
||||
takeInt(2.unaryPlus())
|
||||
takeInt(2.unaryMinus())
|
||||
takeInt(2.inv())
|
||||
takeInt(1.inc())
|
||||
takeInt(1.dec())
|
||||
}
|
||||
|
||||
fun testNoOperators() {
|
||||
takeByte(1)
|
||||
takeInt(1)
|
||||
takeLong(1)
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-38895
|
||||
|
||||
fun takeByte(b: Byte) {}
|
||||
fun takeInt(b: Int) {}
|
||||
fun takeLong(b: Long) {}
|
||||
|
||||
fun testByteBinaryOperators() {
|
||||
takeByte(<!TYPE_MISMATCH!>2 + 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 - 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 * 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 / 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 % 1<!>)
|
||||
|
||||
takeByte(<!TYPE_MISMATCH!>2.plus(1)<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.minus(1)<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.times(1)<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.div(1)<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.rem(1)<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 shl 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 shr 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 ushr 1<!>)
|
||||
|
||||
takeByte(<!TYPE_MISMATCH!>2 and 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 or 1<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2 xor 1<!>)
|
||||
}
|
||||
|
||||
fun testByteUnaryOperators() {
|
||||
// No mismatch
|
||||
takeByte(+1)
|
||||
takeByte(-1)
|
||||
|
||||
// Mismatch
|
||||
takeByte(<!TYPE_MISMATCH!>2.unaryPlus()<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.unaryMinus()<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>2.inv()<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>1.inc()<!>)
|
||||
takeByte(<!TYPE_MISMATCH!>1.dec()<!>)
|
||||
}
|
||||
|
||||
fun testLongBinaryOperators() {
|
||||
takeLong(<!TYPE_MISMATCH!>2 + 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 - 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 * 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 / 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 % 1<!>)
|
||||
|
||||
takeLong(<!TYPE_MISMATCH!>2.plus(1)<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.minus(1)<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.times(1)<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.div(1)<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.rem(1)<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 shl 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 shr 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 ushr 1<!>)
|
||||
|
||||
takeLong(<!TYPE_MISMATCH!>2 and 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 or 1<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2 xor 1<!>)
|
||||
|
||||
// positive
|
||||
takeLong(2 * 100000000000)
|
||||
}
|
||||
|
||||
fun testLongUnaryOperators() {
|
||||
// No mismatch
|
||||
takeLong(+1)
|
||||
takeLong(-1)
|
||||
|
||||
// Mismatch
|
||||
takeLong(<!TYPE_MISMATCH!>2.unaryPlus()<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.unaryMinus()<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>2.inv()<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>1.inc()<!>)
|
||||
takeLong(<!TYPE_MISMATCH!>1.dec()<!>)
|
||||
}
|
||||
|
||||
fun testIntBinaryOperators() {
|
||||
takeInt(2 + 1)
|
||||
takeInt(2 - 1)
|
||||
takeInt(2 * 1)
|
||||
takeInt(2 / 1)
|
||||
takeInt(2 % 1)
|
||||
|
||||
takeInt(2.plus(1))
|
||||
takeInt(2.minus(1))
|
||||
takeInt(2.times(1))
|
||||
takeInt(2.div(1))
|
||||
takeInt(2.rem(1))
|
||||
takeInt(2 shl 1)
|
||||
takeInt(2 shr 1)
|
||||
takeInt(2 ushr 1)
|
||||
|
||||
takeInt(2 and 1)
|
||||
takeInt(2 or 1)
|
||||
takeInt(2 xor 1)
|
||||
}
|
||||
|
||||
fun testIntUnaryOperators() {
|
||||
takeInt(+1)
|
||||
takeInt(-1)
|
||||
|
||||
takeInt(2.unaryPlus())
|
||||
takeInt(2.unaryMinus())
|
||||
takeInt(2.inv())
|
||||
takeInt(1.inc())
|
||||
takeInt(1.dec())
|
||||
}
|
||||
|
||||
fun testNoOperators() {
|
||||
takeByte(1)
|
||||
takeInt(1)
|
||||
takeLong(1)
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package
|
||||
|
||||
public fun takeByte(/*0*/ b: kotlin.Byte): kotlin.Unit
|
||||
public fun takeInt(/*0*/ b: kotlin.Int): kotlin.Unit
|
||||
public fun takeLong(/*0*/ b: kotlin.Long): kotlin.Unit
|
||||
public fun testByteBinaryOperators(): kotlin.Unit
|
||||
public fun testByteUnaryOperators(): kotlin.Unit
|
||||
public fun testIntBinaryOperators(): kotlin.Unit
|
||||
public fun testIntUnaryOperators(): kotlin.Unit
|
||||
public fun testLongBinaryOperators(): kotlin.Unit
|
||||
public fun testLongUnaryOperators(): kotlin.Unit
|
||||
public fun testNoOperators(): kotlin.Unit
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-38895
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-38895
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
// SKIP_KT_DUMP
|
||||
// This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321).
|
||||
// Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895).
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
// For reasons this test is ignored, go to KT-46419
|
||||
// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design
|
||||
|
||||
val test1: Long = 42
|
||||
val test2: Short = 42
|
||||
|
||||
Reference in New Issue
Block a user