3a9ecf0bce
Change resolution to consider extensions to implicit receiver before members of another implicit receiver. Make synthesized member-like extensions resolve right after the members. #KT-10510 Fixed #KT-10219 Fixed
39 lines
650 B
Kotlin
Vendored
39 lines
650 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
|
|
|
// FILE: A.java
|
|
public class A {
|
|
public A getFoo() { return 3; }
|
|
}
|
|
|
|
// FILE: B.java
|
|
public class B {
|
|
public B getFoo() { return ""; }
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
class C(val foo: C)
|
|
|
|
fun test(a: A, b: B, c: C) {
|
|
with(a) {
|
|
with(b) {
|
|
foo checkType { _<B>() }
|
|
}
|
|
foo checkType { _<A>() }
|
|
}
|
|
|
|
with(a) {
|
|
with(c) {
|
|
foo checkType { _<C>() }
|
|
}
|
|
}
|
|
|
|
with(c) {
|
|
with(a) {
|
|
foo checkType { _<A>() }
|
|
}
|
|
}
|
|
}
|
|
|
|
fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
|