interpret class in class object as static nested class
removed hack in TaskPrioritizer for import class from class object
This commit is contained in:
@@ -43,7 +43,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isClassObject;
|
|
||||||
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.isOrOverridesSynthesized;
|
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.isOrOverridesSynthesized;
|
||||||
import static org.jetbrains.jet.lang.resolve.calls.tasks.ExplicitReceiverKind.*;
|
import static org.jetbrains.jet.lang.resolve.calls.tasks.ExplicitReceiverKind.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
|
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
|
||||||
@@ -322,22 +321,6 @@ public class TaskPrioritizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (receiverParameters.size() == 1 && !receiverParameters.iterator().next().exists()) {
|
|
||||||
for (D descriptor : descriptors) {
|
|
||||||
if (descriptor.getExpectedThisObject() != null && descriptor.getReceiverParameter() == null) {
|
|
||||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
|
||||||
if (descriptor instanceof ConstructorDescriptor) {
|
|
||||||
containingDeclaration = containingDeclaration.getContainingDeclaration();
|
|
||||||
}
|
|
||||||
if (containingDeclaration != null && isClassObject(containingDeclaration)) {
|
|
||||||
ResolutionCandidate<D> candidate = ResolutionCandidate.create(descriptor);
|
|
||||||
candidate.setThisObject(((ClassDescriptor) containingDeclaration).getThisAsReceiverParameter().getValue());
|
|
||||||
candidate.setExplicitReceiverKind(ExplicitReceiverKind.NO_EXPLICIT_RECEIVER);
|
|
||||||
result.add(candidate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package f
|
||||||
|
|
||||||
|
import f.A.B
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class object {
|
||||||
|
class B
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() = B()
|
||||||
@@ -21,4 +21,4 @@ fun f1() = ENTRY
|
|||||||
fun f2() = ANOTHER
|
fun f2() = ANOTHER
|
||||||
fun f3() = Nested()
|
fun f3() = Nested()
|
||||||
fun f4() = Nested.foo()
|
fun f4() = Nested.foo()
|
||||||
fun f5() = values()
|
fun f5() = <!UNRESOLVED_REFERENCE!>values<!>()
|
||||||
@@ -1374,6 +1374,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
doTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt");
|
doTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("importClassInClassObject.kt")
|
||||||
|
public void testImportClassInClassObject() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/classObjects/importClassInClassObject.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InnerClassClassObject.kt")
|
@TestMetadata("InnerClassClassObject.kt")
|
||||||
public void testInnerClassClassObject() throws Exception {
|
public void testInnerClassClassObject() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/classObjects/InnerClassClassObject.kt");
|
doTest("compiler/testData/diagnostics/tests/classObjects/InnerClassClassObject.kt");
|
||||||
|
|||||||
@@ -432,8 +432,7 @@ public class DescriptorUtils {
|
|||||||
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
|
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
|
||||||
return descriptor instanceof ClassDescriptor &&
|
return descriptor instanceof ClassDescriptor &&
|
||||||
containing instanceof ClassDescriptor &&
|
containing instanceof ClassDescriptor &&
|
||||||
!((ClassDescriptor) descriptor).isInner() &&
|
!((ClassDescriptor) descriptor).isInner();
|
||||||
!((ClassDescriptor) containing).getKind().isSingleton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ fun main() {
|
|||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
class object {
|
class object {
|
||||||
public val TEST: String = ""
|
object TEST {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ fun main() {
|
|||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
class object {
|
class object {
|
||||||
public val TEST: String = ""
|
object TEST {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user