Proper scoping for inner classes: they must shadow outer classes
This commit is contained in:
@@ -137,8 +137,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
public JetScope getScopeForMemberDeclarationResolution() {
|
||||
if (scopeForMemberDeclarationResolution == null) {
|
||||
WritableScopeImpl scope = new WritableScopeImpl(
|
||||
getScopeForClassHeaderResolution(), this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
|
||||
scope.importScope(getScopeForMemberLookup());
|
||||
getScopeForMemberLookup(), this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
|
||||
scope.importScope(getScopeForClassHeaderResolution());
|
||||
|
||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
scopeForMemberDeclarationResolution = scope;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class B {
|
||||
class B {
|
||||
fun foo(b: B.C) {
|
||||
}
|
||||
class C {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace <root>
|
||||
|
||||
internal final class B : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): B
|
||||
internal final class B.B : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): B.B
|
||||
internal final class B.B.C : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): B.B.C
|
||||
}
|
||||
internal final fun foo(/*0*/ b: B.B.C): jet.Tuple0
|
||||
}
|
||||
}
|
||||
+5
@@ -1277,6 +1277,11 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/genericFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InnerClassNameClash.kt")
|
||||
public void testInnerClassNameClash() throws Exception {
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/InnerClassNameClash.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerObject.kt")
|
||||
public void testInnerObject() throws Exception {
|
||||
doTest("compiler/testData/lazyResolve/namespaceComparator/innerObject.kt");
|
||||
|
||||
Reference in New Issue
Block a user