Lazy resolve: Package-level objects are handled properly
This commit is contained in:
+4
-1
@@ -145,7 +145,10 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
||||
JetClassOrObject classOrObjectDeclaration = declarationProvider.getClassOrObjectDeclaration(name);
|
||||
if (classOrObjectDeclaration instanceof JetObjectDeclaration) {
|
||||
JetObjectDeclaration objectDeclaration = (JetObjectDeclaration) classOrObjectDeclaration;
|
||||
ClassDescriptor classifier = (ClassDescriptor) getClassifier(name);
|
||||
ClassDescriptor classifier = getObjectDescriptor(name);
|
||||
if (classifier == null) {
|
||||
throw new IllegalStateException("Object declaration " + name + " found in the DeclarationProvider " + declarationProvider + " but not in the scope " + this);
|
||||
}
|
||||
VariableDescriptor propertyDescriptor = resolveSession.getInjector().getDescriptorResolver()
|
||||
.resolveObjectDeclaration(thisDescriptor, objectDeclaration, classifier, resolveSession.getTrace());
|
||||
result.add(propertyDescriptor);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package foo
|
||||
|
||||
object Bar {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace <root>
|
||||
|
||||
// <namespace name="foo">
|
||||
namespace foo
|
||||
|
||||
internal final val Bar: foo.Bar
|
||||
// </namespace name="foo">
|
||||
+5
@@ -1275,6 +1275,11 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/genericFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("packageLevelObject.kt")
|
||||
public void testPackageLevelObject() throws Exception {
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClass.kt")
|
||||
public void testSimpleClass() throws Exception {
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/simpleClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user