PY-20610 Fix function annotation highlighting

Fix PyTypeCheckerInspection so it doesn't highlight arrow in python 3 type annotations.
This commit is contained in:
Lada Gagina
2016-09-04 21:29:46 +03:00
parent f6c92f4e37
commit 08fc28f682
2 changed files with 2 additions and 2 deletions
@@ -126,7 +126,7 @@ public class PyTypeCheckerInspection extends PyInspection {
final PyType expected = myTypeEvalContext.getReturnType(node);
final String expectedName = PythonDocumentationProvider.getTypeName(expected, myTypeEvalContext);
if (expected != null && !(expected instanceof PyNoneType)) {
registerProblem(annotation != null ? annotation : node.getTypeComment(),
registerProblem(annotation != null ? annotation.getValue() : node.getTypeComment(),
String.format("Expected to return '%s', got no return", expectedName));
}
}
@@ -36,7 +36,7 @@ def h(x) -> int:
def i() -> Union[int, str]:
pass
def j(x) <warning descr="Expected to return 'Union[int, str]', got no return">-> Union[int, str]</warning>:
def j(x) -> <warning descr="Expected to return 'Union[int, str]', got no return">Union[int, str]</warning>:
x = 42
def k() -> None: