Treating # type: ignore - additional stuff as a valid # type: ignore makes more sense to me than erroring on it. The intent seems pretty clear to write an error suppression plus some comment. I agree that the spec doesn’t currently specify what to do here, but if we were going to update it, I’d rather codify what’s currently in the conformance test (which pyright, pyrefly, and ty already implement) than a suboptimal behavior driven by a limitation in mypy.
For # type: ignore[additional_stuff], I can see the argument for allowing an error about additional_stuff being an invalid code, but it seems tricky to update that line to allow both mypy’s and pyright’s behavior, since they’re so different. (Mypy also reports an assignment error, since that error code isn’t suppressed.) Maybe we could change it to:
z: int = "" # type: ignore[assignment]
so that the expected behavior in all type checkers is that there’s no error?