[ty] fix unpacking a type alias with detailed tuple spec by carljm · Pull Request #19981 · astral-sh/ruff (original) (raw)

Summary

Fixes astral-sh/ty#1046

We special-case iteration of certain types because they may have a more detailed tuple-spec. Now that type aliases are a distinct type variant, we need to handle them as well.

I don't love that Type::TypeAlias means we have to remember to add a case for it basically anywhere we are special-casing a certain kind of type, but at the moment I don't have a better plan. It's another argument for avoiding fallback cases in Type matches, which we usually prefer; I've updated this match statement to be comprehensive.

Test Plan

Added mdtest.