KT-51284 Fix SAM conversion for methods with context receivers
This commit is contained in:
committed by
Space Team
parent
cc9beb466e
commit
4676072137
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
class Context
|
||||
|
||||
fun interface SAM {
|
||||
context(Context)
|
||||
fun foo(x: Int): Int
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val sam1 = SAM { x -> x + 1 }
|
||||
val sam2 = SAM { 2 }
|
||||
val sam3 = SAM { it + 1 }
|
||||
|
||||
with(Context()) {
|
||||
sam1.foo(0)
|
||||
sam2.foo(0)
|
||||
sam3.foo(0)
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user