Commit cb22683f authored by Andrey Vlasovskikh's avatar Andrey Vlasovskikh
Browse files

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.
parent f54be870
Showing with 14 additions and 2 deletions
+14 -2
......@@ -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
......
def func(x, y):
"""
>>> func(True, <warning descr="Unresolved reference 'True2'">True2</warning>)
"""
return True, <error descr="Unresolved reference 'True2'">True2</error>
......@@ -637,6 +637,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
doMultiFileTest();
}
// PY-24637
public void testPy2TrueInDocTest() {
doTest();
}
@NotNull
@Override
protected Class<? extends PyInspection> getInspectionClass() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment