mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-24637 Use non-resolvable built-in constants check for doctest and Jupyter references
Since the switch to the builtins from Typeshed we no longer have the definitions for True, False, None for PY2. We have to ignore these references via null highlighting severity as we do in the base method for PyReferenceImpl.
This commit is contained in:
@@ -25,7 +25,8 @@ public class IpnbPyReference extends PyReferenceImpl {
|
||||
|
||||
@Override
|
||||
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
|
||||
return HighlightSeverity.WARNING;
|
||||
final HighlightSeverity severity = super.getUnresolvedHighlightSeverity(context);
|
||||
return severity != null ? HighlightSeverity.WARNING : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -51,7 +51,8 @@ public class PyDocReference extends PyReferenceImpl {
|
||||
|
||||
@Override
|
||||
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
|
||||
return HighlightSeverity.WARNING;
|
||||
final HighlightSeverity severity = super.getUnresolvedHighlightSeverity(context);
|
||||
return severity != null ? HighlightSeverity.WARNING : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
def func(x, y):
|
||||
"""
|
||||
>>> func(True, <warning descr="Unresolved reference 'True2'">True2</warning>)
|
||||
"""
|
||||
return True, <error descr="Unresolved reference 'True2'">True2</error>
|
||||
+5
@@ -637,6 +637,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
// PY-24637
|
||||
public void testPy2TrueInDocTest() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user