Files
Mikhail Glukhikh 83cfcc30c6 K2: handle type parameter vs nested class conflict in body resolve properly
This commit does two things:
- prioritize type parameter scopes against static scopes in body resolve
(effectively it's a revert of KT-58028 fix)
- consider type parameters as inapplicable callable, so during callable
resolve we can go up the tower and still resolve to static scope

This allows both KT-58028 and KT-63377 to work properly
#KT-63377 Fixed
2023-11-24 21:28:16 +00:00

31 lines
831 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_VARIABLE
interface A
object B
class C
fun test() {
val interface_as_fun = <!INTERFACE_AS_FUNCTION!>A<!>()
val interface_as_val = <!NO_COMPANION_OBJECT!>A<!>
val object_as_fun = <!UNRESOLVED_REFERENCE!>B<!>()
val class_as_val = <!NO_COMPANION_OBJECT!>C<!>
}
fun <T> bar() {
val typeParameter_as_val = <!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>
val typeParameter_as_fun = <!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>()
baz(<!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>)
baz("$<!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>")
1 <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>
B::class.equals(<!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>T<!>)
<!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION, VARIABLE_EXPECTED!>T<!> = ""
}
fun baz(a: Any) {}