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:
Alexander Udalov
2018-06-27 19:41:13 +02:00
parent 56f509ba09
commit dcbb8045bd
25 changed files with 164 additions and 1 deletions
@@ -0,0 +1,17 @@
// !LANGUAGE: -FunctionTypesWithBigArity
// !DIAGNOSTICS: -UNUSED_PARAMETER
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
) {}
fun bar(x: Any) {}
fun test(vararg x: <!UNSUPPORTED_FEATURE!>Function30<!><*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>) {
bar(<!UNSUPPORTED_FEATURE!>::foo<!>)
bar(x)
}
@@ -0,0 +1,12 @@
package
public fun bar(/*0*/ x: kotlin.Any): kotlin.Unit
public fun foo(/*0*/ p00: A, /*1*/ p01: A, /*2*/ p02: A, /*3*/ p03: A, /*4*/ p04: A, /*5*/ p05: A, /*6*/ p06: A, /*7*/ p07: A, /*8*/ p08: A, /*9*/ p09: A, /*10*/ p10: A, /*11*/ p11: A, /*12*/ p12: A, /*13*/ p13: A, /*14*/ p14: A, /*15*/ p15: A, /*16*/ p16: A, /*17*/ p17: A, /*18*/ p18: A, /*19*/ p19: A, /*20*/ p20: A, /*21*/ p21: A, /*22*/ p22: A, /*23*/ p23: A, /*24*/ p24: A, /*25*/ p25: A, /*26*/ p26: A, /*27*/ p27: A, /*28*/ p28: A, /*29*/ p29: A): kotlin.Unit
public fun test(/*0*/ vararg x: kotlin.Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, kotlin.Unit> /*kotlin.Array<out kotlin.Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, kotlin.Unit>>*/): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}