Open ixje opened 3 years ago
Here's a shorter repro:
[bytes, bytearray]
See https://github.com/python/typing/issues/552 for some more context.
A good workaround here is to use a tuple instead of a list (since tuples are heterogeneous, mypy won't need to perform a join).
There's still something strange going on here that the linked issue doesn't fully explain, though surely the implicit promotion has something to do with it. The error doesn't repro with [float, int]
or [int, float]
, even though these are also implicitly promoted, or with [bytearray, bytes]
.
the error reproduces with arbitrary types, in function arguments, assigning etc
Argument 3 to "..." has incompatible type "List[PlatformFees]"; expected "List[PlatformFees]" mypy(error)
Argument 2 to "..." has incompatible type "CIPSolution"; expected "CIPSolution" mypy(error)
Bug Report
Error message seems to indicate it requires the type it is getting. I could be reading the error message wrong, but this one confuses me.
To Reproduce
put the code in a file e.g. scratchpad.py
mypy scratchpad.py
Expected Behavior no errors
Actual Behavior
Your Environment
mypy.ini
(and other config files): n/a