Resolve type of anonymous object in local object as local

This commit is contained in:
Svetlana Isakova
2014-08-19 15:17:43 +04:00
parent f811b9541c
commit eaeed78154
3 changed files with 15 additions and 1 deletions
@@ -1125,7 +1125,7 @@ public class DescriptorResolver {
}
boolean definedInClass = DescriptorUtils.getParentOfType(descriptor, ClassDescriptor.class) != null;
boolean isLocal = descriptor.getContainingDeclaration() instanceof CallableDescriptor;
boolean isLocal = DescriptorUtils.isLocal(descriptor);
Visibility visibility = descriptor.getVisibility();
boolean transformNeeded = !isLocal && !visibility.isPublicAPI()
&& !(definedInClass && Visibilities.PRIVATE.equals(visibility));
@@ -0,0 +1,9 @@
fun foo() {
val a = object {
val b = object {
val c = 42
}
}
a.b.c : Int
}
@@ -5916,6 +5916,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest("compiler/testData/diagnostics/tests/objects/kt5527.kt");
}
@TestMetadata("localObjectInsideObject.kt")
public void testLocalObjectInsideObject() throws Exception {
doTest("compiler/testData/diagnostics/tests/objects/localObjectInsideObject.kt");
}
@TestMetadata("objectLiteralExpressionTypeMismatch.kt")
public void testObjectLiteralExpressionTypeMismatch() throws Exception {
doTest("compiler/testData/diagnostics/tests/objects/objectLiteralExpressionTypeMismatch.kt");