Do not use incorrect import
This commit is contained in:
@@ -150,9 +150,12 @@ class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator
|
|||||||
if (importDirective.isAllUnder) {
|
if (importDirective.isAllUnder) {
|
||||||
val packageOrClassDescriptor = resolveToPackageOrClass(path, moduleDescriptor, trace, packageFragmentForCheck,
|
val packageOrClassDescriptor = resolveToPackageOrClass(path, moduleDescriptor, trace, packageFragmentForCheck,
|
||||||
scopeForFirstPart = null, position = QualifierPosition.IMPORT) ?: return null
|
scopeForFirstPart = null, position = QualifierPosition.IMPORT) ?: return null
|
||||||
|
|
||||||
if (packageOrClassDescriptor is ClassDescriptor && packageOrClassDescriptor.kind.isSingleton) {
|
if (packageOrClassDescriptor is ClassDescriptor && packageOrClassDescriptor.kind.isSingleton) {
|
||||||
trace.report(Errors.CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor)) // todo report on star
|
trace.report(Errors.CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor)) // todo report on star
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return AllUnderImportScope(packageOrClassDescriptor)
|
return AllUnderImportScope(packageOrClassDescriptor)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ package b
|
|||||||
import a.C1.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>O<!>.*
|
import a.C1.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>O<!>.*
|
||||||
|
|
||||||
fun testErroneusAllUnderImportFromObject() {
|
fun testErroneusAllUnderImportFromObject() {
|
||||||
A()
|
<!UNRESOLVED_REFERENCE!>A<!>()
|
||||||
B
|
<!UNRESOLVED_REFERENCE!>B<!>
|
||||||
<!UNRESOLVED_REFERENCE!>bar<!>()
|
<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ package b
|
|||||||
import a.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>O<!>.*
|
import a.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>O<!>.*
|
||||||
|
|
||||||
fun testErroneusAllUnderImportFromObject() {
|
fun testErroneusAllUnderImportFromObject() {
|
||||||
A()
|
<!UNRESOLVED_REFERENCE!>A<!>()
|
||||||
B
|
<!UNRESOLVED_REFERENCE!>B<!>
|
||||||
<!UNRESOLVED_REFERENCE!>bar<!>()
|
<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import c.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>M<!>.*
|
|||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val <!UNUSED_VARIABLE!>b<!>: B = B()
|
val <!UNUSED_VARIABLE!>b<!>: B = B()
|
||||||
var <!UNUSED_VARIABLE!>r<!>: R = R()
|
var <!UNUSED_VARIABLE!>r<!>: <!UNRESOLVED_REFERENCE!>R<!> = <!UNRESOLVED_REFERENCE!>R<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
class A() {
|
class A() {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ val y: T = Y
|
|||||||
fun f() {
|
fun f() {
|
||||||
bar()
|
bar()
|
||||||
R.bar()
|
R.bar()
|
||||||
B.foo()
|
<!UNRESOLVED_REFERENCE!>B<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
object M {
|
object M {
|
||||||
|
|||||||
Reference in New Issue
Block a user