Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/protectedVisibility/syntheticSAMExtensions.kt
T
Stanislav Erokhin 8f0b073c08 [NI] Prototype for SAM-conversion.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
2018-06-04 12:21:56 +03:00

32 lines
538 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// FILE: abc/A.java
package abc;
public class A {
protected void foo(Runnable x) {}
}
// FILE: main.kt
import abc.A;
class Data(var x: A)
class B : A() {
fun baz(a: A, b: B, d: Data) {
a.<!INVISIBLE_MEMBER!>foo<!> { }
b.foo { }
if (a is B) {
<!DEBUG_INFO_SMARTCAST!>a<!>.foo {}
}
if (d.x is B) {
<!OI;SMARTCAST_IMPOSSIBLE!>d.x<!>.<!NI;INVISIBLE_MEMBER!>foo<!> {}
}
}
}
fun baz(a: A) {
a.<!INVISIBLE_MEMBER!>foo<!> { }
}