Yes, I think that the underlying issue is not related to str
vs LiteralStr
per se, it’s entirely around the fact that in certain context it could be possible to upcast otherwise-invariant types.
I’m not proposing we actually add ownership to the type system, just observing that it could enable a lot of common (and safe-at-runtime) patterns where people get invariance complaints today.
Adding ownership would be a big change, so we’d have to see huge benefits. A big drop on false positives would be one benefit, but I doubt enough. Maybe if GIL-less python leads to a lot more concerns about thread-safety this would become more likely worthwhile.