280c445783
This change touches the following diagnostics to make them behave closer
to FE1.0
* SUPER_NOT_AVAILABLE
* SUPER_IS_NOT_AN_EXPRESSION
* INSTANCE_ACCESS_BEFORE_SUPER_CALL
* NOT_A_SUPERTYPE
Other than tweaking the diagnostics, this change also alters resolution
by consider marking `super` with mismatched type parameter as
errorenous. As a result, the following code no longer resolves.
```
class A: B() {
fun test() {
super<String>.length
// ^^^^^^ FIR currently resolves this to `String.length`.
// With this change, `length` becomes unresolved
// instead
}
}
```
Also, now we report `UNRESOLVED_LABEL` on unresolved label on `super`
reference, though FE1.0 reports `UNRESOLVED_REFERENCE`.
All the errors above are reported as ConeDiagnostics and hence some
checkers are deleted.
In addition, it also suppresses more downstream (mostly unresolved)
errors if the receiver has errors. FE1.0 doesn't do it for all the cases
we have here. But it seems nicer to reduce these "redundant" unresolved
errors.
28 lines
754 B
Kotlin
Vendored
28 lines
754 B
Kotlin
Vendored
// NI_EXPECTED_FILE
|
|
|
|
class Outer {
|
|
fun function() = 42
|
|
val property = ""
|
|
|
|
class Nested {
|
|
fun f() = <!UNRESOLVED_REFERENCE!>function<!>()
|
|
fun g() = <!UNRESOLVED_REFERENCE!>property<!>
|
|
fun h() = this<!UNRESOLVED_LABEL!>@Outer<!>.function()
|
|
fun i() = this<!UNRESOLVED_LABEL!>@Outer<!>.property
|
|
}
|
|
|
|
inner class Inner {
|
|
fun innerFun() = function()
|
|
val innerProp = property
|
|
fun innerThisFun() = this@Outer.function()
|
|
val innerThisProp = this@Outer.property
|
|
|
|
inner class InnerInner {
|
|
fun f() = innerFun()
|
|
fun g() = innerProp
|
|
fun h() = this@Inner.innerFun()
|
|
fun i() = this@Inner.innerProp
|
|
}
|
|
}
|
|
}
|