mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
new inference for enum constants (IDEA-144973)
This commit is contained in:
@@ -647,14 +647,14 @@ public class InferenceSession {
|
||||
if (gParent instanceof PsiAnonymousClass) {
|
||||
gParent = gParent.getParent();
|
||||
}
|
||||
if (gParent instanceof PsiCallExpression) {
|
||||
final PsiExpressionList argumentList = ((PsiCallExpression)gParent).getArgumentList();
|
||||
if (gParent instanceof PsiCall) {
|
||||
final PsiExpressionList argumentList = ((PsiCall)gParent).getArgumentList();
|
||||
if (argumentList != null) {
|
||||
final MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
|
||||
if (properties != null && properties.isApplicabilityCheck()) {
|
||||
return getTypeByMethod(context, argumentList, properties.getMethod(), properties.isVarargs(), properties.getSubstitutor());
|
||||
}
|
||||
final JavaResolveResult result = properties != null ? properties.getInfo() : ((PsiCallExpression)gParent).resolveMethodGenerics();
|
||||
final JavaResolveResult result = properties != null ? properties.getInfo() : ((PsiCall)gParent).resolveMethodGenerics();
|
||||
final boolean varargs = properties != null && properties.isVarargs() || result instanceof MethodCandidateInfo && ((MethodCandidateInfo)result).isVarargs();
|
||||
PsiSubstitutor substitutor = PsiResolveHelper.ourGraphGuard.doPreventingRecursion(context, false,
|
||||
new Computable<PsiSubstitutor>() {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
import java.util.Comparator;
|
||||
import static java.util.Comparator.*;
|
||||
|
||||
enum TestEnum {
|
||||
E(naturalOrder());
|
||||
|
||||
TestEnum(Comparator<String> c) {}
|
||||
}
|
||||
@@ -299,6 +299,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEnumConstantInference() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user