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() {
|
public JetScope getScopeForMemberDeclarationResolution() {
|
||||||
if (scopeForMemberDeclarationResolution == null) {
|
if (scopeForMemberDeclarationResolution == null) {
|
||||||
WritableScopeImpl scope = new WritableScopeImpl(
|
WritableScopeImpl scope = new WritableScopeImpl(
|
||||||
getScopeForClassHeaderResolution(), this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
|
getScopeForMemberLookup(), this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
|
||||||
scope.importScope(getScopeForMemberLookup());
|
scope.importScope(getScopeForClassHeaderResolution());
|
||||||
|
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
scopeForMemberDeclarationResolution = scope;
|
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");
|
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")
|
@TestMetadata("innerObject.kt")
|
||||||
public void testInnerObject() throws Exception {
|
public void testInnerObject() throws Exception {
|
||||||
doTest("compiler/testData/lazyResolve/namespaceComparator/innerObject.kt");
|
doTest("compiler/testData/lazyResolve/namespaceComparator/innerObject.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user