mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21:26 +00:00
Support default property reference inlining
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
fun ok() = "OK"
|
||||
|
||||
class A(val value: String) {
|
||||
fun ok() = value
|
||||
}
|
||||
|
||||
22
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromObject.kt
vendored
Normal file
22
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromObject.kt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
fun ok() = "OK"
|
||||
|
||||
object A {
|
||||
fun ok() = "OK"
|
||||
}
|
||||
|
||||
inline fun inlineFun(lambda: () -> String = A::ok): String {
|
||||
return lambda()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return inlineFun()
|
||||
}
|
||||
18
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReference.kt
vendored
Normal file
18
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReference.kt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
val ok = "OK"
|
||||
|
||||
inline fun inlineFun(lambda: () -> String = ::ok): String {
|
||||
return lambda()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return inlineFun()
|
||||
}
|
||||
18
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReferenceFromClass.kt
vendored
Normal file
18
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReferenceFromClass.kt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
class A(val ok: String)
|
||||
|
||||
inline fun inlineFun(a: A, lambda: (A) -> String = A::ok): String {
|
||||
return lambda(a)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return inlineFun(A("OK"))
|
||||
}
|
||||
20
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReferenceFromObject.kt
vendored
Normal file
20
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/propertyReferenceFromObject.kt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
object A {
|
||||
val ok = "OK"
|
||||
}
|
||||
|
||||
inline fun inlineFun(lambda: () -> String = A::ok): String {
|
||||
return lambda()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return inlineFun()
|
||||
}
|
||||
Reference in New Issue
Block a user