do not need to check stand-alone class object for class,

when it's on the left hand side of dot it is analyzed in 'getIdForImplicitReceiver' (test added)
This commit is contained in:
Svetlana Isakova
2013-07-05 18:02:28 +04:00
parent 9fd8a8d497
commit d3e6d2d6cd
3 changed files with 27 additions and 4 deletions
@@ -202,10 +202,6 @@ public class DataFlowValueFactory {
if (declarationDescriptor instanceof NamespaceDescriptor) {
return createNamespaceInfo(declarationDescriptor);
}
if (declarationDescriptor instanceof ClassDescriptor) {
ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor;
return createInfo(classDescriptor, classDescriptor.getClassObjectDescriptor() != null);
}
return NO_IDENTIFIER_INFO;
}
@@ -0,0 +1,22 @@
open class T {
val x : Int? = null
}
class A {
class object: T() {
}
}
class B {
class object: T() {
}
}
fun test() {
if (A.x != null) {
useInt(A.x)
useInt(<!TYPE_MISMATCH!>B.x<!>)
}
}
fun useInt(i: Int) = i
@@ -4867,6 +4867,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/smartCasts"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("classObjectMember.kt")
public void testClassObjectMember() throws Exception {
doTest("compiler/testData/diagnostics/tests/smartCasts/classObjectMember.kt");
}
@TestMetadata("combineWithNoSelectorInfo.kt")
public void testCombineWithNoSelectorInfo() throws Exception {
doTest("compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt");