Force resolve descriptor type

This commit is contained in:
Nikolay Krasko
2014-02-10 19:33:25 +04:00
parent a2c567da93
commit f14ff9405d
6 changed files with 51 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.resolve.lazy;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
@@ -70,6 +71,10 @@ public class ForceResolveUtil {
LazyEntity lazyEntity = (LazyEntity) object;
lazyEntity.forceResolveAllContents();
}
else if (object instanceof CallableDescriptor) {
CallableDescriptor callableDescriptor = (CallableDescriptor) object;
forceResolveAllContents(callableDescriptor.getReturnType());
}
}
public static void forceResolveAllContents(@Nullable JetType type) {
@@ -0,0 +1,9 @@
package test
trait A
class <caret>B {
class object {
fun bar() = object : A { }
}
}
@@ -0,0 +1,5 @@
package test
trait A
class <caret>B(val bar: A = object: A {}, val withError = object: A {}, notProperty = object: A {})
@@ -0,0 +1,7 @@
package test
trait A
public class <caret>B {
private val bar = object : A {}
}
@@ -0,0 +1,7 @@
package test
trait A
public class <caret>B {
private fun bar() = object : A { }
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,6 +63,22 @@ public class JetJavaFacadeTest extends JetLightCodeInsightFixtureTestCase {
doTestWrapClass();
}
public void testClassWithObjectLiteralInClassObjectField() {
doTestWrapClass();
}
public void testClassWithObjectLiteralInConstructorProperty() {
doTestWrapClass();
}
public void testClassWithObjectLiteralInFun() {
doTestWrapClass();
}
public void testClassWithObjectLiteralInField() {
doTestWrapClass();
}
public void testWrapFunInClassObject() {
doTestWrapMethod(true);
}