[FIR] Report missing UNRESOLVED_IMPORT
#KT-54781 Fixed
This commit is contained in:
committed by
Space Team
parent
f18591ffef
commit
7dde3603b5
@@ -1,4 +1,4 @@
|
||||
import incorrect.directory.My
|
||||
import <!UNRESOLVED_IMPORT!>incorrect<!>.directory.My
|
||||
|
||||
open class My : <!CYCLIC_INHERITANCE_HIERARCHY!>My<!>()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import incorrect.directory.Your
|
||||
import <!UNRESOLVED_IMPORT!>incorrect<!>.directory.Your
|
||||
|
||||
typealias My = <!UNRESOLVED_REFERENCE!>incorrect.directory.My<!>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// IGNORE_REVERSED_RESOLVE
|
||||
// Ignore reason: KT-57619
|
||||
import my.println
|
||||
import <!UNRESOLVED_IMPORT!>my<!>.println
|
||||
|
||||
enum class Order {
|
||||
FIRST,
|
||||
|
||||
@@ -10,7 +10,7 @@ interface ByteArray {
|
||||
|
||||
package use
|
||||
|
||||
import test.*
|
||||
import <!UNRESOLVED_IMPORT!>test<!>.*
|
||||
|
||||
interface My {
|
||||
// Should be kotlin.ByteArray
|
||||
|
||||
+8
-2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.syntax
|
||||
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
@@ -90,6 +91,11 @@ object FirUnresolvedInMiddleOfImportChecker : FirDeclarationSyntaxChecker<FirFil
|
||||
return enumClass.collectEnumEntries().any { it.callableId.callableName == classId.shortClassName }
|
||||
}
|
||||
|
||||
private fun KtSourceElement.dotQualifiedExpression() = getChild(KtNodeTypes.DOT_QUALIFIED_EXPRESSION, depth = 1)
|
||||
private fun KtSourceElement.selectorExpression() = getChild(KtNodeTypes.REFERENCE_EXPRESSION, depth = 1, reverse = true)
|
||||
private val IMPORT_PARENT_TOKEN_TYPES = TokenSet.create(KtNodeTypes.DOT_QUALIFIED_EXPRESSION, KtNodeTypes.REFERENCE_EXPRESSION)
|
||||
|
||||
private fun KtSourceElement.dotQualifiedExpression(): KtSourceElement? = getChild(IMPORT_PARENT_TOKEN_TYPES, depth = 1)
|
||||
|
||||
private fun KtSourceElement.selectorExpression(): KtSourceElement? =
|
||||
takeIf { it.elementType == KtNodeTypes.REFERENCE_EXPRESSION }
|
||||
?: getChild(KtNodeTypes.REFERENCE_EXPRESSION, depth = 1, reverse = true)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import java.*
|
||||
import java.util.*
|
||||
import utils.*
|
||||
import <!UNRESOLVED_IMPORT!>utils<!>.*
|
||||
|
||||
import java.io.PrintStream
|
||||
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Com
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import com.unknown
|
||||
import <!UNRESOLVED_IMPORT!>com<!>.unknown
|
||||
|
||||
fun ff() {
|
||||
val a = <!UNRESOLVED_REFERENCE!>unknown<!>()
|
||||
val b = a?.plus(42)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ 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 <!UNRESOLVED_IMPORT!>smth<!>.illegal
|
||||
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
|
||||
import <!UNRESOLVED_IMPORT!>unr<!>.unr.unr
|
||||
|
||||
fun test(arg: B) {
|
||||
foo(value)
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
import foo.bar.baz
|
||||
import Outer.`<no name provided>`.getInner
|
||||
// FILE: Klass.kt
|
||||
package pkg
|
||||
|
||||
private class Klass
|
||||
|
||||
// FILE: test.kt
|
||||
package pack
|
||||
|
||||
import <!UNRESOLVED_IMPORT!>foo<!>.bar.baz
|
||||
import <!UNRESOLVED_IMPORT!>Outer<!>.`<no name provided>`.getInner
|
||||
import pack.<!UNRESOLVED_IMPORT!>UnresolvedName<!>
|
||||
import pkg.Klass
|
||||
|
||||
class MainSource
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
// FILE: Klass.kt
|
||||
package pkg
|
||||
|
||||
private class Klass
|
||||
|
||||
// FILE: test.kt
|
||||
package pack
|
||||
|
||||
import <!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>baz<!>
|
||||
import <!UNRESOLVED_REFERENCE!>Outer<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>`<no name provided>`<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>getInner<!>
|
||||
import pack.<!UNRESOLVED_REFERENCE!>UnresolvedName<!>
|
||||
import pkg.<!INVISIBLE_REFERENCE!>Klass<!>
|
||||
|
||||
class MainSource
|
||||
|
||||
@@ -10,14 +10,14 @@ import b.C.Companion.bar //function from companion object
|
||||
import b.C.Companion.cValue //property from companion object
|
||||
import b.<!UNRESOLVED_IMPORT!>constant<!>.fff //function from val
|
||||
import b.<!UNRESOLVED_IMPORT!>constant<!>.dValue //property from val
|
||||
import smth.illegal
|
||||
import <!UNRESOLVED_IMPORT!>smth<!>.illegal
|
||||
import b.C.<!UNRESOLVED_IMPORT!>smth<!>.illegal
|
||||
|
||||
<!SYNTAX!><<!><!SYNTAX!><<!><!SYNTAX!><<!><!SYNTAX!>HEAD<!><!SYNTAX!><!>
|
||||
import b.<!UNRESOLVED_IMPORT!>bar<!>.smth
|
||||
import b.<!UNRESOLVED_IMPORT!>bar<!>.*
|
||||
import b.<!UNRESOLVED_IMPORT!>unr<!>.unr.unr
|
||||
import unr.unr.unr
|
||||
import <!UNRESOLVED_IMPORT!>unr<!>.unr.unr
|
||||
import b.constant
|
||||
import b.E.Companion.f //val from companion object
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
package kt1080
|
||||
|
||||
import reflect.Constructor
|
||||
import <!UNRESOLVED_IMPORT!>reflect<!>.Constructor
|
||||
|
||||
import b.*
|
||||
import <!UNRESOLVED_IMPORT!>d<!>
|
||||
import d.Test
|
||||
import <!UNRESOLVED_IMPORT!>d<!>.Test
|
||||
import b.<!PACKAGE_CANNOT_BE_IMPORTED!>d<!>
|
||||
|
||||
class Some: <!UNRESOLVED_REFERENCE!>Test<!>()
|
||||
|
||||
Reference in New Issue
Block a user