Summary
Ran into this while making my umpteenth generic parser generator soup and messed up a parser generator transformer.
https://play.ty.dev/d0fab0ef-bf5d-496f-b305-046e604cd702
from dataclasses import dataclass
@dataclass
class Box[T]: # T is invariant
item: T
type RefBox[T] = Box[T] # T is invariant
type RefRefBox[T] = RefBox[T] # T is bivariant???
When combined with #3517, you can make a type safe transmute (this happened in my actual code):
https://play.ty.dev/eff23d78-ef4e-4bda-8aa7-b9848e527cb3
Version
ty 0.0.35 (bc12d1c 2026-05-10) playground 7efc9a6
Summary
Ran into this while making my umpteenth generic parser generator soup and messed up a parser generator transformer.
https://play.ty.dev/d0fab0ef-bf5d-496f-b305-046e604cd702
When combined with #3517, you can make a type safe transmute (this happened in my actual code):
https://play.ty.dev/eff23d78-ef4e-4bda-8aa7-b9848e527cb3
Version
ty 0.0.35 (bc12d1c 2026-05-10) playground 7efc9a6