mirror of
https://github.com/astral-sh/ruff.git
synced 2026-11-21 12:16:15 +08:00
ty could panic when checking a decorated class if it inferred the return type of an inner decorator and an outer decorator returned a class from another module. During cycle recovery, ty could use that replacement class's scope to look up names in the file that defined the original class. Preserve the original class before applying decorators and use it for class-definition checks. The decorated name still takes the type returned by the outer decorator. Fixes astral-sh/ty#5021. ## Test plan Checked the reported `EnumCheck` example with return type inference enabled. Before this change it panicked. With the fix, ty reports the invalid argument to `@d2` and finishes checking the file.