Open JohanSchott opened 2 years ago
Hmm, I don't think the issue has anything to do specifically with the "test" in the function name; I see the same problem if I change the function names from test_func
and a_test_func
to z_func
and a_func
. pytype sorts methods by name before analyzing them, so it seems what's going on is that the None
type is correctly preserved in functions that are analyzed before the function that returns the None
but turned into Any
in functions analyzed after the function that returns the None
.
Please consider two identical functions
test_func
anda_test_func
, except for the function names.pytype
for this code reportsI expected the first
reveal_type
(on line 11) to sayOptional[int]
and to be the same as the output from the forthreveal_type
. Somehow it seems that having "test" in the beginning of a function name leads to unexpected types.I'm using
pytype 2022.2.8
andPython 3.8.10
.(
mypy
reports the expectedUnion[builtins.int, None]
at the firstreveal_type
. )