The _T TypeVar was declared with bound=_KernelType, where _KernelType is a CompiledKernel | StaticallyLaunchedCudaKernel | StaticallyLaunchedXpuKernel union.
A union bound doesn't give a TypeVar any real constraining power; the spec-correct form for "exactly one of these three" is a constrained TypeVar (positional arguments).
Switch to that, keep _KernelType as an explicit TypeAlias for the few sites that genuinely want the union (return types, local annotations), and pin the two definitions together with an import-time assert so they can't silently drift.
The three aggregate CompileResult[_KernelType] sites become CompileResult[Any] since a constrained TypeVar can't be parameterized with the union itself.
Fixes #184159
Authored by Claude
Pull Request resolved: #184412
Approved by: https://github.com/jansel, https://github.com/Skylion007