Bug Report
See title, I think this is the cause of the remaining issue for #9424. I think this is a followup to #19183.
To Reproduce
fromtypingimportTypeVar, final@finalclassA:
passU=TypeVar('U', bound=A|int)
deff(u: U) ->U:
ifisinstance(u, A):
returnA()
else:
returnuExpected Behavior
No errors
Actual Behavior
There's an error:
main.py:11: error: Incompatible return value type (got "A", expected "U") [return-value]
Found 1 error in 1 file (checked 1 source file)
Your Environment
Reproduced on mypy play.
- Mypy version used: v1.16
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini (and other config files): N/A - Python version used: 3.12
Bug Report
See title, I think this is the cause of the remaining issue for #9424. I think this is a followup to #19183.
To Reproduce
Expected Behavior
No errors
Actual Behavior
There's an error:
Your Environment
Reproduced on mypy play.
mypy.ini(and other config files): N/A