Allow to turn the first parameter of a SAM-converted lambda into the receiver (KT-12848)
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
// FILE: Sam.java
|
||||
@SamWithReceiver
|
||||
public interface Sam {
|
||||
void run();
|
||||
}
|
||||
|
||||
// FILE: Exec.java
|
||||
public class Exec {
|
||||
void exec(Sam sam) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
annotation class SamWithReceiver
|
||||
|
||||
fun test() {
|
||||
val e = Exec()
|
||||
|
||||
e.exec {
|
||||
System.out.println("Hello, world!")
|
||||
}
|
||||
|
||||
e.exec {
|
||||
val a: String = <!NO_THIS!>this<!>
|
||||
System.out.println(a)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user