Resolve type of anonymous object in local object as local
This commit is contained in:
@@ -1125,7 +1125,7 @@ public class DescriptorResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean definedInClass = DescriptorUtils.getParentOfType(descriptor, ClassDescriptor.class) != null;
|
boolean definedInClass = DescriptorUtils.getParentOfType(descriptor, ClassDescriptor.class) != null;
|
||||||
boolean isLocal = descriptor.getContainingDeclaration() instanceof CallableDescriptor;
|
boolean isLocal = DescriptorUtils.isLocal(descriptor);
|
||||||
Visibility visibility = descriptor.getVisibility();
|
Visibility visibility = descriptor.getVisibility();
|
||||||
boolean transformNeeded = !isLocal && !visibility.isPublicAPI()
|
boolean transformNeeded = !isLocal && !visibility.isPublicAPI()
|
||||||
&& !(definedInClass && Visibilities.PRIVATE.equals(visibility));
|
&& !(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");
|
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")
|
@TestMetadata("objectLiteralExpressionTypeMismatch.kt")
|
||||||
public void testObjectLiteralExpressionTypeMismatch() throws Exception {
|
public void testObjectLiteralExpressionTypeMismatch() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/objects/objectLiteralExpressionTypeMismatch.kt");
|
doTest("compiler/testData/diagnostics/tests/objects/objectLiteralExpressionTypeMismatch.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user