Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/resolve/kt8596.kt
T
Alexander Udalov 00f1415ed7 Fix "rewrite at slice LEXICAL_SCOPE" during callable reference resolution
Following the TODO in CallableReferencesResolutionUtils.kt, delete the
suspicious scope and use the new resolution process with the qualifier which
was obtained after the resolution of LHS. However, by default the tower
resolution algorithm also considers each qualifier as a class value as well,
which would be wrong here because resolution of LHS as a "value" happens
earlier in DoubleColonExpressionResolver and with slightly different rules. To
avoid that, do not mix in the "explicit receiver" scope tower processor when
creating processors for callable reference resolution.

Also delete unused functions and classes related to deleted scope, refactor
Scopes.kt

 #KT-8596 Fixed
2016-07-22 11:05:19 +03:00

26 lines
474 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
// KT-8596 Rewrite at slice LEXICAL_SCOPE for nested class constructor reference in an argument position
class K {
class Nested
}
fun foo(f: Any) {}
fun test1() {
foo(K::Nested)
}
// KT-10567 Error: Rewrite at slice LEXICAL_SCOPE key: REFERENCE_EXPRESSION
class Foo(val a: String, val b: String)
fun test2() {
val prop : Foo.() -> String = if (true) {
Foo::a
} else {
Foo::b
}
}