FIR checker: report unresolved reference in imports

Compared to FE1.0, instead of using UNRESOLVED_REFERENCE, a new
UNRESOLVED_IMPORT diagnostic is introduced. This is so that we can use a
different positioning strategy to highlight the last part of the import
if the entire import is passed.

Also, this change fixed some incorrectly rejected imports in FIR. Such
cases are covered the newly added test file staticFunAndPropertyImport.kt
This commit is contained in:
Tianyu Geng
2021-10-25 17:37:38 -07:00
committed by teamcityserver
parent f51b108821
commit 18f7a760bb
33 changed files with 470 additions and 95 deletions
+6 -6
View File
@@ -7,15 +7,15 @@ import b.ext //extension function
import b.value //property
import b.C.Companion.bar //function from companion object
import b.C.Companion.cValue //property from companion object
import b.constant.fff //function from val
import b.constant.dValue //property from val
import b.<!UNRESOLVED_IMPORT!>constant<!>.fff //function from val
import b.<!UNRESOLVED_IMPORT!>constant<!>.dValue //property from val
import b.constant
import b.E.Companion.f //val from companion object
import smth.illegal
import b.C.smth.illegal
import b.bar.smth
import b.bar.*
import b.unr.unr.unr
import b.C.<!UNRESOLVED_IMPORT!>smth<!>.illegal
import b.<!UNRESOLVED_IMPORT!>bar<!>.smth
import b.<!UNRESOLVED_IMPORT!>bar<!>.*
import b.<!UNRESOLVED_IMPORT!>unr<!>.unr.unr
import unr.unr.unr
fun test(arg: B) {
@@ -52,27 +52,27 @@ import <!PACKAGE_CANNOT_BE_IMPORTED!>a<!>
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>b<!>
import a.foo
import a.foo.bar
import a.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.bar
import a.bar.foo
import a.<!UNRESOLVED_IMPORT!>bar<!>.foo
import a.B.<!CANNOT_BE_IMPORTED!>foo<!>
import a.B.foo.bar
import a.B.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.B.<!CANNOT_BE_IMPORTED!>bar<!>
import a.B.bar.foo
import a.B.<!UNRESOLVED_IMPORT!>bar<!>.foo
import a.C.foo
import a.C.foo.bar
import a.C.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.C.bar
import a.C.bar.foo
import a.C.<!UNRESOLVED_IMPORT!>bar<!>.foo
import a.C.Nested
import a.D.foo
import a.D.foo.bar
import a.D.bar
import a.D.bar.foo
import a.D.<!UNRESOLVED_IMPORT!>foo<!>
import a.D.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.D.<!UNRESOLVED_IMPORT!>bar<!>
import a.D.<!UNRESOLVED_IMPORT!>bar<!>.foo
import a.D.Companion.foo
import a.D.Companion.foo.bar
import a.D.Companion.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.D.Companion.bar
import a.D.Companion.bar.foo
import a.D.Companion.<!UNRESOLVED_IMPORT!>bar<!>.foo
+2 -2
View File
@@ -18,7 +18,7 @@ interface IInterfaceOutput<out T> {
package mypackage.nestedpackage
import mypackage.nestedpackage.Bar.Baz
import mypackage.nestedpackage.Bar.<!UNRESOLVED_IMPORT!>Baz<!>
import anotherpackage.IInterfaceInput
import anotherpackage.IInterfaceOutput
@@ -43,4 +43,4 @@ class Bar() : IInterfaceInput<Baz>, IInterfaceOutput<Baz> {
}
data class Baz(val myField: Int)
data class Baz(val myField: Int)
@@ -8,15 +8,15 @@ import b.ext //extension function
import b.value //property
import b.C.Companion.bar //function from companion object
import b.C.Companion.cValue //property from companion object
import b.constant.fff //function from val
import b.constant.dValue //property from val
import b.<!UNRESOLVED_IMPORT!>constant<!>.fff //function from val
import b.<!UNRESOLVED_IMPORT!>constant<!>.dValue //property from val
import smth.illegal
import b.C.smth.illegal
import b.C.<!UNRESOLVED_IMPORT!>smth<!>.illegal
<!SYNTAX!><<!><!SYNTAX!><<!><!SYNTAX!><<!><!SYNTAX!>HEAD<!><!SYNTAX!><!>
import b.bar.smth
import b.bar.*
import b.unr.unr.unr
import b.<!UNRESOLVED_IMPORT!>bar<!>.smth
import b.<!UNRESOLVED_IMPORT!>bar<!>.*
import b.<!UNRESOLVED_IMPORT!>unr<!>.unr.unr
import unr.unr.unr
import b.constant
import b.E.Companion.f //val from companion object