Running NavigateToLibrarySourceTest with force resolve, as well.
This commit is contained in:
@@ -38,6 +38,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
@@ -59,6 +60,8 @@ import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
|
||||
import java.util.*;
|
||||
|
||||
public class JetSourceNavigationHelper {
|
||||
private static boolean forceResolve = false;
|
||||
|
||||
private JetSourceNavigationHelper() {
|
||||
}
|
||||
|
||||
@@ -335,18 +338,20 @@ public class JetSourceNavigationHelper {
|
||||
+ decompiledContainer.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
candidates = filterByReceiverPresenceAndParametersCount(decompiledDeclaration, navigationStrategy, candidates);
|
||||
|
||||
if (candidates.size() <= 1) {
|
||||
return getUnambiguousCandidate(candidates);
|
||||
}
|
||||
|
||||
if (!haveRenamesInImports(getContainingFiles(candidates))) {
|
||||
candidates = filterByReceiverAndParameterTypes(decompiledDeclaration, navigationStrategy, candidates);
|
||||
if (!forceResolve) {
|
||||
candidates = filterByReceiverPresenceAndParametersCount(decompiledDeclaration, navigationStrategy, candidates);
|
||||
|
||||
if (candidates.size() <= 1) {
|
||||
return getUnambiguousCandidate(candidates);
|
||||
}
|
||||
|
||||
if (!haveRenamesInImports(getContainingFiles(candidates))) {
|
||||
candidates = filterByReceiverAndParameterTypes(decompiledDeclaration, navigationStrategy, candidates);
|
||||
|
||||
if (candidates.size() <= 1) {
|
||||
return getUnambiguousCandidate(candidates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pair<BindingContext, JetScope> contextAndMemberScope = getBindingContextAndMemberScopeForLibrarySources(decompiledDeclaration);
|
||||
@@ -481,6 +486,11 @@ public class JetSourceNavigationHelper {
|
||||
return getSourcePropertyOrFunction(decompiledFunction, new FunctionNavigationStrategy());
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
static void setForceResolve(boolean forceResolve) {
|
||||
JetSourceNavigationHelper.forceResolve = forceResolve;
|
||||
}
|
||||
|
||||
private interface NavigationStrategy<Decl extends JetNamedDeclaration, Descr extends CallableDescriptor> {
|
||||
@NotNull
|
||||
Class<Decl> getDeclarationClass();
|
||||
|
||||
@@ -84,6 +84,12 @@ public class NavigateToLibrarySourceTest extends AbstractNavigateToLibraryTest {
|
||||
userFile = LocalFileSystem.getInstance().findFileByPath(TEST_DATA_PATH + "/usercode/" + getTestName(false) + ".kt");
|
||||
assertNotNull(userFile);
|
||||
|
||||
checkAnnotatedLibraryCode(false);
|
||||
checkAnnotatedLibraryCode(true);
|
||||
}
|
||||
|
||||
private void checkAnnotatedLibraryCode(boolean forceResolve) {
|
||||
JetSourceNavigationHelper.setForceResolve(forceResolve);
|
||||
String actualCode = getActualAnnotatedLibraryCode();
|
||||
String expectedCode = getExpectedAnnotatedLibraryCode();
|
||||
assertSameLines(expectedCode, actualCode);
|
||||
|
||||
Reference in New Issue
Block a user