This phenomenon was originally discovered by @dmarteau in #19892. I wrote and ran the following two tests under Python 3.12 and mypy master (1.19.0+dev) and they succeeded.