Do not generate unnecessary super-call checks for functions with defaults
Such check should only be generated for a function in an open class #KT-11962 Fixed
This commit is contained in:
+4
-3
@@ -8,6 +8,7 @@ class A {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
// Test argument reordering when call site argument order differs from declaration one: 18 + 1 for super call check
|
||||
// 13 LOAD
|
||||
// 5 STORE
|
||||
|
||||
// Test argument reordering when call site argument order differs from declaration one
|
||||
// 12 LOAD
|
||||
// 5 STORE
|
||||
|
||||
+4
-3
@@ -7,6 +7,7 @@ class A {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
// Test there is no argument reordering when call site argument order same as declaration one: 15 + 1 for super call check
|
||||
// 10 LOAD
|
||||
// 2 STORE
|
||||
|
||||
// Test there is no argument reordering when call site argument order same as declaration one
|
||||
// 9 LOAD
|
||||
// 2 STORE
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// KT-11962 Super call with default parameters check is generated for top-level function
|
||||
|
||||
fun foo(x: Int = 1) { }
|
||||
|
||||
class FinalClass {
|
||||
fun bar(x: Int = 2) { }
|
||||
}
|
||||
|
||||
object Object {
|
||||
fun baz(x: Int = 3) { }
|
||||
}
|
||||
|
||||
fun test() {
|
||||
fun local(x: Int = 4) { }
|
||||
}
|
||||
|
||||
// 0 ATHROW
|
||||
@@ -1,13 +0,0 @@
|
||||
inline fun test(a: Int = 1, b: Long = 1L, c: String = "123") {
|
||||
val d = 1
|
||||
}
|
||||
|
||||
//
|
||||
// 1 test\$default\(IJLjava/lang/String;ILjava/lang/Object;\)V\s+L0
|
||||
// 1 LOCALVARIABLE a I L0 L8 0
|
||||
// 1 LOCALVARIABLE b J L0 L8 1
|
||||
// 1 LOCALVARIABLE c Ljava/lang/String; L0 L8 3
|
||||
// 1 LOCALVARIABLE \$i\$f\$test I L5 L8 4
|
||||
// 1 LOCALVARIABLE d I L7 L8 5
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
class A {
|
||||
open class A {
|
||||
inline fun test(a: Int = 1, b: Long = 1L, c: String = "123") {
|
||||
val d = 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user