<!-- If you're not sure whether what you're experiencing is a mypy bug, please see the "Question and Help" form instead. Please consider: - checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html - searching our issue tracker: https://github.com/python/mypy/issues to see if it's already been reported - asking on gitter chat: https://gitter.im/python/typing --> **Bug Report** <!-- If you're reporting a problem with a specific library function, the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues If the project you encountered the issue in is open source, please provide a link to the project. --> See title, I think this is the cause of the remaining issue for https://github.com/python/mypy/issues/9424. I think this is a followup to https://github.com/python/mypy/pull/19183. **To Reproduce** ```python from typing import TypeVar, final @final class A: pass U = TypeVar('U', bound=A | int) def f(u: U) -> U: if isinstance(u, A): return A() else: return u ``` **Expected 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 <!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->