FIR: pass the qualified access source when reporting ErrorNamedReference
Currently if there is an error in a function call, FIR would report the entire expression if this call is qualified, but *only* the name if it's not qualified. For example, assume the following two calls are all contains some errors. ``` a.foo(1,2,3) ^^^^^^^^^^^^ bar(1,2,3) ^^^ ``` The entire call of `foo` is reported since it's qualified. But only the reference `bar` is reported since it's not qualified. This limits the usage of position strategies because the IDE does not allow position strategies to go outside of the initially reported PSI element (org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass#addDiagnostic). This change passes both the original error named reference and the surrounding qualified access expression and defer the decision of which to use to the reporting logic. For unresolved reference and checks on `super` keyword, the position strategy should not highlight the surrounding parentheses. Hence a new position strategy `REFERENCED_NAME_BY_QUALIFIED` is added. In addition, this change also has the following side effect * some diagnostics are no longer reported when there is a syntax error since the higher level structure does not exist when there is a syntax error
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
8805675539
commit
d6907222cd
-1
@@ -8,4 +8,3 @@ fun <F, G> getMap() : Map<F, G> = throw Exception()
|
||||
fun bar123() {
|
||||
foo(<!INAPPLICABLE_CANDIDATE!>getMap<!>(
|
||||
<!SYNTAX!><!>}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user