Allow to turn the first parameter of a SAM-converted lambda into the receiver (KT-12848)
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
// FILE: Sam.java
|
||||
@SamWithReceiver
|
||||
public interface Sam {
|
||||
void run(String a);
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
annotation class SamWithReceiver
|
||||
|
||||
fun test() {
|
||||
Sam { <!EXPECTED_PARAMETERS_NUMBER_MISMATCH, CANNOT_INFER_PARAMETER_TYPE!>a<!> ->
|
||||
System.out.println(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>)
|
||||
}
|
||||
|
||||
Sam {
|
||||
val a: String = this
|
||||
val a2: String = <!UNRESOLVED_REFERENCE!>it<!>
|
||||
System.out.println(a)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user