mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
PY-76076 Use proper python version for pyi files to evaluate version guards (PyDefUseUtil).
(cherry picked from commit cc6529de62f7c687c606697b9207170b7903f96d) IJ-MR-147937 GitOrigin-RevId: 32b1f2d47fecc5592e5b93265c195ca3051497b9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3fdadc1b6b
commit
22cae80f9d
@@ -31,6 +31,7 @@ import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyAugAssignmentStatementNavigator;
|
||||
import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
|
||||
import com.jetbrains.python.psi.types.PyNarrowedType;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -141,7 +142,7 @@ public final class PyDefUseUtil {
|
||||
private static boolean unreachableDueToVersionGuard(@NotNull Instruction instruction) {
|
||||
PsiElement element = instruction.getElement();
|
||||
if (element == null) return false;
|
||||
LanguageLevel languageLevel = LanguageLevel.forElement(element);
|
||||
LanguageLevel languageLevel = PythonLanguageLevelPusher.getLanguageLevelForFile(element.getContainingFile());
|
||||
Version version = new Version(languageLevel.getMajorVersion(), languageLevel.getMinorVersion(), 0);
|
||||
return !evaluateVersionsForElement(element).contains(version);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user