Closed carljm closed 6 years ago
Repro is slightly more complex than I'd thought; Union[List[Any]]
simplifies to just List[Any]
and never hits this rewriter. So in order to repro you need traces that result in a type like Union[List[Any], Set[Any]]
; i.e. a function where some arg is given two different empty container types in different calls. This repros:
mymod.py
:
def myfunc(things):
pass
and myscript.py
:
from mymod import myfunc
myfunc([])
myfunc(set())
monkeytype run myscript.py
monkeytype stub mymod
The end of the traceback looks like:
Haven't worked on a repro, but from looking at the code I think it ought to be pretty easy to repro with e.g. a
List
parameter that is only ever called with an empty list. In this case we should just leave the annotation asList[Any]
, there's nothing else we can do.