mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-21906 Fixed: Code inspection stops working with StackOverflowError in PassExecutorService
Don't resolve qualified references in PyResolveUtil.resolveLocally.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -108,7 +108,7 @@ public class PyResolveUtil {
|
||||
public static Collection<PsiElement> resolveLocally(@NotNull PyReferenceExpression referenceExpression) {
|
||||
final String referenceName = referenceExpression.getName();
|
||||
|
||||
if (referenceName == null) {
|
||||
if (referenceName == null || referenceExpression.isQualified()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1703,6 +1703,17 @@ public class PyTypeTest extends PyTestCase {
|
||||
"expr = min(l)");
|
||||
}
|
||||
|
||||
// PY-21906
|
||||
public void testSOFOnTransitiveNamedTupleFields() {
|
||||
final PyExpression expression = parseExpr("from collections import namedtuple\n" +
|
||||
"class C:\n" +
|
||||
" FIELDS = ('a', 'b')\n" +
|
||||
"FIELDS = C.FIELDS\n" +
|
||||
"expr = namedtuple('Tup', FIELDS)");
|
||||
|
||||
getTypeEvalContexts(expression).forEach(context -> context.getType(expression));
|
||||
}
|
||||
|
||||
private static List<TypeEvalContext> getTypeEvalContexts(@NotNull PyExpression element) {
|
||||
return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
|
||||
TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());
|
||||
|
||||
Reference in New Issue
Block a user