Properly process primitive receiver on inlining bound callable references
#KT-18728 Fixed
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
inline fun inlineFun(a: Int, lambda: (Int) -> Int = 1::plus): Int {
|
||||
return lambda(a)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val result = inlineFun(2)
|
||||
return if (result == 3) return "OK" else "fail $result"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
inline fun inlineFun(a: Int, lambda: (Int) -> Int = 1::plus): Int {
|
||||
return lambda(a)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val result = inlineFun(2)
|
||||
return if (result == 3) return "OK" else "fail $result"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
val Int.myInc
|
||||
get() = this + 1
|
||||
|
||||
|
||||
inline fun inlineFun(lambda: () -> Int = 1::myInc): Int {
|
||||
return lambda()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val result = inlineFun()
|
||||
return if (result == 2) return "OK" else "fail $result"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
val Long.myInc
|
||||
get() = this + 1
|
||||
|
||||
|
||||
inline fun inlineFun(lambda: () -> Long = 1L::myInc): Long {
|
||||
return lambda()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val result = inlineFun()
|
||||
return if (result == 2L) return "OK" else "fail $result"
|
||||
}
|
||||
Reference in New Issue
Block a user