Disallow function types with big arity on JVM if LV < 1.3 or API < 1.3
The implementation is a bit obscure because this worked on JS since Kotlin 1.0 and we should not break that; however, on JVM, a diagnostic will be reported with old language/API version #KT-25241 Fixed
This commit is contained in:
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: J.java
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
class A(val value: Int) {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// IGNORE_BACKEND: JS_IR, JS
|
||||
|
||||
class A
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
|
||||
class A
|
||||
|
||||
fun foo(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
|
||||
class A(val value: Int)
|
||||
|
||||
private fun check(actual: A, expected: Int) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: J.java
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -FunctionTypesWithBigArity
|
||||
|
||||
// This test does not make sense for JVM because a diagnostic is reported when function types with big arity are not available
|
||||
// (see diagnostics/tests/sourceCompatibility/noBigFunctionTypes.kt)
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
class A
|
||||
|
||||
fun foo(
|
||||
p00: A, p01: A, p02: A, p03: A, p04: A, p05: A, p06: A, p07: A, p08: A, p09: A,
|
||||
p10: A, p11: A, p12: A, p13: A, p14: A, p15: A, p16: A, p17: A, p18: A, p19: A,
|
||||
p20: A, p21: A, p22: A, p23: A, p24: A, p25: A, p26: A, p27: A, p28: A, p29: A
|
||||
): String = "OK"
|
||||
|
||||
fun bar(x: Function30<A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, String>): String {
|
||||
val a = A()
|
||||
return x(a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return bar(::foo)
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
|
||||
// Implementing function interface is prohibited in JavaScript
|
||||
// IGNORE_BACKEND: JS_IR, JS
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: Test.java
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
||||
// WITH_REFLECT
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
||||
// WITH_REFLECT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user