Proper scoping for inner classes: they must shadow outer classes

This commit is contained in:
Andrey Breslav
2012-07-19 18:12:12 +04:00
parent 8c1fd5e9c7
commit 3403e6c95d
4 changed files with 27 additions and 2 deletions
@@ -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
}
}
@@ -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");