File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,6 +540,10 @@ def type_of_expression(expr: libcst.BaseExpression) -> Optional[Type[object]]:
540540 return None
541541 elif isinstance (expr , libcst .Name ) and expr .value in ("True" , "False" ):
542542 return bool
543+ elif isinstance (expr , libcst .UnaryOperation ) and isinstance (
544+ expr .operator , libcst .Not
545+ ):
546+ return bool
543547 elif (
544548 isinstance (expr , libcst .Call )
545549 and isinstance (expr .func , libcst .Attribute )
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ def foo():
4949 def bar():
5050 return 1
5151
52+ def return_not(x):
53+ return not x
54+
5255 def formatter(x):
5356 return "{}".format(x)
5457
@@ -68,6 +71,9 @@ def foo():
6871 def bar() -> int:
6972 return 1
7073
74+ def return_not(x) -> bool:
75+ return not x
76+
7177 def formatter(x) -> str:
7278 return "{}".format(x)
7379
You can’t perform that action at this time.
0 commit comments