You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Obviously, this example is infinitely recursive. The original code that produced the error was more complicated so I distilled it down to the simplest example that still triggers the error.
fromtypingimportUnion, NamedTupleclassFoo(NamedTuple):
bar: Union[Foo, bool]
defmake_foo() ->Union[Foo, bool]:
returnFoo(make_foo())
# foo.py:7: error: Incompatible return value type (got "Foo", expected "Union[Foo, bool]")
Replacing the body of make_foo with the following does not get rid of the error, but produces an extra error which may or may not be unrelated.
bar: Union[Foo, bool] =make_foo()
returnFoo(bar)
# foo.py:7: error: Incompatible types in assignment (expression has type "Union[Foo, bool]", variable has type "Union[Foo, bool]")# foo.py:8: error: Incompatible return value type (got "Foo", expected "Union[Foo, bool]")````