Minor. Improver import resolve, when some error happened
This commit is contained in:
@@ -101,8 +101,9 @@ public interface Errors {
|
||||
|
||||
// Imports
|
||||
|
||||
DiagnosticFactory1<JetSimpleNameExpression, ClassDescriptor> CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, DeclarationDescriptor> CANNOT_BE_IMPORTED = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, ClassDescriptor> CANNOT_IMPORT_MEMBERS_FROM_SINGLETON = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<JetSimpleNameExpression, Name> CANNOT_BE_IMPORTED = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<JetSimpleNameExpression> PACKAGE_CANNOT_BE_IMPORTED = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<JetExpression, String> CONFLICTING_IMPORT = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
|
||||
+3
-2
@@ -143,8 +143,9 @@ public class DefaultErrorMessages {
|
||||
MAP.put(LABEL_NAME_CLASH, "There is more than one label with such a name in this scope");
|
||||
MAP.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, "Expression expected, but a package name found");
|
||||
|
||||
MAP.put(CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON, "Cannot import-on-demand from object ''{0}''", NAME);
|
||||
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", NAME);
|
||||
MAP.put(CANNOT_IMPORT_MEMBERS_FROM_SINGLETON, "Cannot import members from object ''{0}''", NAME);
|
||||
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", TO_STRING);
|
||||
MAP.put(PACKAGE_CANNOT_BE_IMPORTED, "Packages cannot be imported");
|
||||
MAP.put(CONFLICTING_IMPORT, "Conflicting import, imported name ''{0}'' is ambiguous", STRING);
|
||||
MAP.put(PLATFORM_CLASS_MAPPED_TO_KOTLIN, "This class shouldn''t be used in Kotlin. Use {0} instead.", CLASSES_OR_SEPARATED);
|
||||
|
||||
|
||||
+64
-12
@@ -56,42 +56,91 @@ public class NewQualifiedExpressionResolver(val symbolUsageValidator: SymbolUsag
|
||||
if (importDirective.isAllUnder) {
|
||||
val packageOrClassDescriptor = resolveToPackageOrClass(path, moduleDescriptor, trace, shouldBeVisibleFrom) ?: return JetScope.Empty
|
||||
if (packageOrClassDescriptor is ClassDescriptor && packageOrClassDescriptor.kind.isSingleton) {
|
||||
trace.report(Errors.CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor))
|
||||
trace.report(Errors.CANNOT_IMPORT_MEMBERS_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor)) // todo report on star
|
||||
}
|
||||
val scope = AllUnderImportsScope()
|
||||
scope.addAllUnderImport(packageOrClassDescriptor)
|
||||
return scope
|
||||
}
|
||||
else {
|
||||
val aliasName = JetPsiUtil.getAliasName(importDirective)
|
||||
if (aliasName == null) { // import kotlin.
|
||||
resolveToPackageOrClass(path, moduleDescriptor, trace, shouldBeVisibleFrom)
|
||||
return JetScope.Empty
|
||||
}
|
||||
|
||||
val packageOrClassDescriptor = resolveToPackageOrClass(path.subList(0, path.size() - 1), moduleDescriptor, trace, shouldBeVisibleFrom)
|
||||
?: return JetScope.Empty
|
||||
val descriptors = SmartList<DeclarationDescriptor>()
|
||||
|
||||
val lastName = lastPart.name
|
||||
val location = lastPart.location
|
||||
when (packageOrClassDescriptor) {
|
||||
is PackageViewDescriptor -> {
|
||||
val packageScope = packageOrClassDescriptor.memberScope
|
||||
descriptors.addIfNotNull(packageScope.getClassifier(lastPart.name, lastPart.location))
|
||||
descriptors.addAll(packageScope.getProperties(lastPart.name, lastPart.location))
|
||||
descriptors.addAll(packageScope.getFunctions(lastPart.name, lastPart.location))
|
||||
descriptors.addIfNotNull(packageScope.getClassifier(lastName, location))
|
||||
descriptors.addAll(packageScope.getProperties(lastName, location))
|
||||
descriptors.addAll(packageScope.getFunctions(lastName, location))
|
||||
}
|
||||
|
||||
is ClassDescriptor -> {
|
||||
descriptors.addIfNotNull(
|
||||
packageOrClassDescriptor.unsubstitutedInnerClassesScope.getClassifier(lastPart.name, lastPart.location)
|
||||
packageOrClassDescriptor.unsubstitutedInnerClassesScope.getClassifier(lastName, location)
|
||||
)
|
||||
val staticClassScope = packageOrClassDescriptor.staticScope
|
||||
descriptors.addAll(staticClassScope.getFunctions(lastPart.name, lastPart.location))
|
||||
descriptors.addAll(staticClassScope.getProperties(lastPart.name, lastPart.location))
|
||||
descriptors.addAll(staticClassScope.getFunctions(lastName, location))
|
||||
descriptors.addAll(staticClassScope.getProperties(lastName, location))
|
||||
}
|
||||
// todo assert?
|
||||
else -> return JetScope.Empty
|
||||
}
|
||||
storageResult(trace, lastPart.expression, descriptors, shouldBeVisibleFrom)
|
||||
|
||||
val aliasName = JetPsiUtil.getAliasName(importDirective) ?: return JetScope.Empty
|
||||
else -> throw IllegalStateException("Should be class or package: $packageOrClassDescriptor")
|
||||
}
|
||||
if (descriptors.isNotEmpty()) {
|
||||
storageResult(trace, lastPart.expression, descriptors, shouldBeVisibleFrom)
|
||||
}
|
||||
else {
|
||||
tryResolveDescriptorsWhichCannotBeImported(trace, moduleDescriptor, packageOrClassDescriptor, lastPart)
|
||||
}
|
||||
|
||||
return SingleImportScope(aliasName, descriptors)
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryResolveDescriptorsWhichCannotBeImported(
|
||||
trace: BindingTrace,
|
||||
moduleDescriptor: ModuleDescriptor,
|
||||
packageOrClassDescriptor: DeclarationDescriptor,
|
||||
lastPart: QualifierPart
|
||||
) {
|
||||
val descriptors = SmartList<DeclarationDescriptor>()
|
||||
val lastName = lastPart.name
|
||||
when (packageOrClassDescriptor) {
|
||||
is PackageViewDescriptor -> {
|
||||
val packageDescriptor = moduleDescriptor.getPackage(packageOrClassDescriptor.fqName.child(lastName))
|
||||
if (!packageDescriptor.isEmpty()) {
|
||||
trace.report(Errors.PACKAGE_CANNOT_BE_IMPORTED.on(lastPart.expression))
|
||||
descriptors.add(packageOrClassDescriptor)
|
||||
}
|
||||
}
|
||||
|
||||
is ClassDescriptor -> {
|
||||
val memberScope = packageOrClassDescriptor.unsubstitutedMemberScope
|
||||
descriptors.addAll(memberScope.getFunctions(lastName, lastPart.location))
|
||||
descriptors.addAll(memberScope.getProperties(lastName, lastPart.location))
|
||||
if (descriptors.isNotEmpty()) {
|
||||
if (packageOrClassDescriptor.kind.isSingleton) {
|
||||
trace.report(Errors.CANNOT_IMPORT_MEMBERS_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor))
|
||||
}
|
||||
else {
|
||||
trace.report(Errors.CANNOT_BE_IMPORTED.on(lastPart.expression, lastName))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> throw IllegalStateException("Should be class or package: $packageOrClassDescriptor")
|
||||
}
|
||||
storageResult(trace, lastPart.expression, descriptors, shouldBeVisibleFrom = null)
|
||||
}
|
||||
|
||||
private fun JetExpression.asQualifierPartList(trace: BindingTrace): List<QualifierPart> {
|
||||
val result = SmartList<QualifierPart>()
|
||||
var expression: JetExpression? = this
|
||||
@@ -140,6 +189,9 @@ public class NewQualifiedExpressionResolver(val symbolUsageValidator: SymbolUsag
|
||||
} ?: moduleDescriptor.quickResolveToPackage(path, trace)
|
||||
return path.subList(currentIndex, path.size()).fold<QualifierPart, DeclarationDescriptor?>(currentDescriptor) {
|
||||
descriptor, qualifierPart ->
|
||||
// report unresolved reference only for first unresolved qualifier
|
||||
if (descriptor == null) return@fold null
|
||||
|
||||
val nextDescriptor = when (descriptor) {
|
||||
// TODO: support inner classes which captured type parameter from outer class
|
||||
is ClassDescriptor ->
|
||||
|
||||
@@ -322,7 +322,7 @@ public class QualifiedExpressionResolver {
|
||||
// Check for more information and additional errors
|
||||
if (canBeImportedDescriptors.isEmpty()) {
|
||||
assert descriptors.size() >= 1;
|
||||
trace.report(CANNOT_BE_IMPORTED.on(referenceExpression, descriptors.iterator().next()));
|
||||
trace.report(CANNOT_BE_IMPORTED.on(referenceExpression, descriptors.iterator().next().getName()));
|
||||
return;
|
||||
}
|
||||
if (canBeImportedDescriptors.size() > 1) {
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ class X
|
||||
// FILE: c.kt
|
||||
package c
|
||||
|
||||
import a.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
import b.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>x<!>
|
||||
import b.<!PACKAGE_CANNOT_BE_IMPORTED!>x<!>
|
||||
|
||||
class Y : <!UNRESOLVED_REFERENCE!>x<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>X<!>
|
||||
@@ -11,7 +11,7 @@ object O {
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
import a.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>O<!>.*
|
||||
import a.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>O<!>.*
|
||||
|
||||
fun test() {
|
||||
A()
|
||||
|
||||
+6
-4
@@ -5,16 +5,18 @@ import b.B //class
|
||||
import b.foo //function
|
||||
import b.ext //extension function
|
||||
import b.value //property
|
||||
import b.C.Companion.<!UNRESOLVED_REFERENCE!>bar<!> //function from companion object
|
||||
import b.C.Companion.<!UNRESOLVED_REFERENCE!>cValue<!> //property from companion object
|
||||
import b.C.Companion.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>bar<!> //function from companion object
|
||||
import b.C.Companion.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>cValue<!> //property from companion object
|
||||
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>fff<!> //function from val
|
||||
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>dValue<!> //property from val
|
||||
import b.constant
|
||||
import b.E.Companion.<!UNRESOLVED_REFERENCE!>f<!> //val from companion object
|
||||
import b.E.Companion.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>f<!> //val from companion object
|
||||
import <!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
||||
import b.C.<!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
||||
import b.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>smth<!>
|
||||
import b.<!UNRESOLVED_REFERENCE!>bar<!>.*
|
||||
import b.<!UNRESOLVED_REFERENCE!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>
|
||||
import <!UNRESOLVED_REFERENCE!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>
|
||||
|
||||
fun test(arg: B) {
|
||||
foo(value)
|
||||
@@ -70,7 +72,7 @@ fun bar() {}
|
||||
//FILE:c.kt
|
||||
package c
|
||||
|
||||
import c.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>C<!>.*
|
||||
import c.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>C<!>.*
|
||||
|
||||
object C {
|
||||
fun f() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package test
|
||||
import <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><!>
|
||||
import <!SYNTAX!>.some<!>
|
||||
import <!SYNTAX!>.kotlin<!>
|
||||
import <!UNRESOLVED_REFERENCE!>kotlin<!>.<!SYNTAX!><!>
|
||||
import <!PACKAGE_CANNOT_BE_IMPORTED!>kotlin<!>.<!SYNTAX!><!>
|
||||
import<!SYNTAX!><!>
|
||||
import <!SYNTAX!>.<!>
|
||||
import <!SYNTAX!>*<!>
|
||||
@@ -2,21 +2,21 @@ package a
|
||||
|
||||
import a.A.*
|
||||
import a.A.C
|
||||
import a.A.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>C<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>D<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>C<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>C<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>D<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>C<!>.*
|
||||
import a.A.C.G
|
||||
import a.A.E.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>J<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>CO<!>.*
|
||||
import a.A.E.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>J<!>.*
|
||||
import a.A.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>CO<!>.*
|
||||
import a.A.CO
|
||||
|
||||
import a.B.C.*
|
||||
import a.B.C.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>A<!>.*
|
||||
import a.B.C.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>D<!>.*
|
||||
import a.B.C.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>A<!>.*
|
||||
import a.B.C.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>D<!>.*
|
||||
|
||||
import a.E.*
|
||||
import a.E.E1
|
||||
import a.E.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>E2<!>.*
|
||||
import a.E.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>E2<!>.*
|
||||
|
||||
class A {
|
||||
object C {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// FILE:a.kt
|
||||
package a
|
||||
|
||||
val foo = 2
|
||||
fun bar() {}
|
||||
|
||||
class B {
|
||||
val foo = 2
|
||||
fun bar() {}
|
||||
|
||||
class C
|
||||
}
|
||||
|
||||
// FILE:b.kt
|
||||
package a.b.c
|
||||
|
||||
class D {
|
||||
class E {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE:c.kt
|
||||
import<!SYNTAX!><!> ;
|
||||
import <!SYNTAX!>.<!>
|
||||
import a.<!SYNTAX!><!> ;
|
||||
import <!SYNTAX!>.a.<!> ;
|
||||
import <!SYNTAX!>.a.b<!> ;
|
||||
import <!SYNTAX!>.a.B<!> ;
|
||||
import a.B.<!SYNTAX!><!> ;
|
||||
import a.B.C.<!SYNTAX!><!> ;
|
||||
import a.B.<!UNRESOLVED_REFERENCE!>foo<!>.<!SYNTAX!><!> ;
|
||||
import a.B.<!UNRESOLVED_REFERENCE!>bar<!>.<!SYNTAX!><!> ;
|
||||
import a.b.<!SYNTAX!><!> ;
|
||||
import a.b.c.<!SYNTAX!><!> ;
|
||||
import a.<!SYNTAX!>%<!>.b.c.<!SYNTAX!><!> ;
|
||||
import a.b.c.D.<!SYNTAX!><!> ;
|
||||
import a.b.c.D.E.<!SYNTAX!><!> ;
|
||||
|
||||
// FILE:d.kt
|
||||
import<!SYNTAX!><!>
|
||||
import <!SYNTAX!>.<!>
|
||||
import <!PACKAGE_CANNOT_BE_IMPORTED!>a<!>.<!SYNTAX!><!>
|
||||
import <!SYNTAX!>.a.<!>
|
||||
import <!SYNTAX!>.a.b<!>
|
||||
import <!SYNTAX!>.a.B<!>
|
||||
import a.B.<!SYNTAX!><!> as<!SYNTAX!><!>
|
||||
import a.B.<!SYNTAX!><!> as A
|
||||
import a.B.<!SYNTAX!><!>
|
||||
import a.B.C.<!SYNTAX!><!>
|
||||
import a.B.<!CANNOT_BE_IMPORTED!>foo<!>.<!SYNTAX!><!>
|
||||
import a.B.<!CANNOT_BE_IMPORTED!>bar<!>.<!SYNTAX!><!>
|
||||
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>b<!>.<!SYNTAX!><!>
|
||||
import a.b.<!PACKAGE_CANNOT_BE_IMPORTED!>c<!>.<!SYNTAX!><!>
|
||||
import a.<!SYNTAX!>%<!>.b.<!PACKAGE_CANNOT_BE_IMPORTED!>c<!>.<!SYNTAX!><!>
|
||||
import a.b.c.D.<!SYNTAX!><!>
|
||||
import a.b.c.D.E.<!SYNTAX!><!>
|
||||
|
||||
import <!PACKAGE_CANNOT_BE_IMPORTED!>a<!><!SYNTAX!>?.<!><!UNRESOLVED_REFERENCE!><!SYNTAX!><!>b<!SYNTAX!><!><!>
|
||||
@@ -0,0 +1,42 @@
|
||||
package
|
||||
|
||||
package a {
|
||||
public val foo: kotlin.Int = 2
|
||||
public fun bar(): kotlin.Unit
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public final val foo: kotlin.Int = 2
|
||||
public final fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package a.b {
|
||||
|
||||
package a.b.c {
|
||||
|
||||
public final class D {
|
||||
public constructor D()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class E {
|
||||
public constructor E()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// FILE:a.kt
|
||||
package a.b
|
||||
|
||||
// FILE:a.kt
|
||||
package a
|
||||
|
||||
val foo = object {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun bar() = object {
|
||||
val foo = 239
|
||||
}
|
||||
|
||||
class B {
|
||||
val foo = object {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun bar() = object {
|
||||
val foo = 239
|
||||
}
|
||||
}
|
||||
|
||||
object C {
|
||||
val foo = object {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun bar() = object {
|
||||
val foo = 239
|
||||
}
|
||||
|
||||
class Nested
|
||||
}
|
||||
|
||||
class D {
|
||||
companion object {
|
||||
val foo = object {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun bar() = object {
|
||||
val foo = 239
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE:b.kt
|
||||
import <!PACKAGE_CANNOT_BE_IMPORTED!>a<!>
|
||||
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>b<!>
|
||||
|
||||
import a.foo
|
||||
import a.<!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>
|
||||
import a.bar
|
||||
import a.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
|
||||
import a.B.<!CANNOT_BE_IMPORTED!>foo<!>
|
||||
import a.B.<!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>
|
||||
import a.B.<!CANNOT_BE_IMPORTED!>bar<!>
|
||||
import a.B.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
|
||||
import a.C.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>foo<!>
|
||||
import a.C.<!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>
|
||||
import a.C.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>bar<!>
|
||||
import a.C.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
import a.C.Nested
|
||||
|
||||
import a.D.<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
import a.D.<!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>
|
||||
import a.D.<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
import a.D.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
|
||||
import a.D.Companion.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>foo<!>
|
||||
import a.D.Companion.<!UNRESOLVED_REFERENCE!>foo<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>
|
||||
import a.D.Companion.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>bar<!>
|
||||
import a.D.Companion.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
@@ -0,0 +1,50 @@
|
||||
package
|
||||
|
||||
package a {
|
||||
public val foo: kotlin.Any
|
||||
public fun bar(): kotlin.Any
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public final val foo: kotlin.Any
|
||||
public final fun bar(): kotlin.Any
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object C {
|
||||
private constructor C()
|
||||
public final val foo: kotlin.Any
|
||||
public final fun bar(): kotlin.Any
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class Nested {
|
||||
public constructor Nested()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class D {
|
||||
public constructor D()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val foo: kotlin.Any
|
||||
public final fun bar(): kotlin.Any
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package a.b {
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import <!UNRESOLVED_REFERENCE!>reflect<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>Const
|
||||
import b.*
|
||||
import <!UNRESOLVED_REFERENCE!>d<!>
|
||||
import <!UNRESOLVED_REFERENCE!>d<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>Test<!>
|
||||
import b.d
|
||||
import b.<!PACKAGE_CANNOT_BE_IMPORTED!>d<!>
|
||||
|
||||
class Some: <!UNRESOLVED_REFERENCE!>Test<!>()
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
package c
|
||||
|
||||
import c.A.Companion.B
|
||||
import c.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>M<!>.*
|
||||
import c.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>M<!>.*
|
||||
|
||||
fun foo() {
|
||||
val <!UNUSED_VARIABLE!>b<!>: B = B()
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@ package d
|
||||
|
||||
//import from objects before properties resolve
|
||||
|
||||
import d.<!CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON!>A<!>.*
|
||||
import d.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>A<!>.*
|
||||
import d.M.R
|
||||
import d.M.R.<!CANNOT_BE_IMPORTED!>bar<!>
|
||||
import d.M.R.<!CANNOT_IMPORT_MEMBERS_FROM_SINGLETON!>bar<!>
|
||||
import d.M.T
|
||||
import d.M.Y
|
||||
|
||||
|
||||
@@ -6699,11 +6699,23 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SyntaxError.kt")
|
||||
public void testSyntaxError() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/SyntaxError.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelClassVsPackage.kt")
|
||||
public void testTopLevelClassVsPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/TopLevelClassVsPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("WrongImport.kt")
|
||||
public void testWrongImport() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/WrongImport.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode")
|
||||
|
||||
Reference in New Issue
Block a user