ruff
c7f6b85f - [`ruff`] Allow dataclass attribute value instantiation from nested frozen dataclass (`RUF009`) (#20352)

Commit
3 days ago
[`ruff`] Allow dataclass attribute value instantiation from nested frozen dataclass (`RUF009`) (#20352) ## Summary Resolves #20266 Definition of the frozen dataclass attribute can be instantiation of a nested frozen dataclass as well as a non-nested one. ### Problem explanation The `function_call_in_dataclass_default` function is invoked during the "defined scope" stage, after all scopes have been processed. At this point, the semantic references the top-level scope. When `SemanticModel::lookup_attribute` executes, it searches for bindings in the top-level module scope rather than the class scope, resulting in an error. To solve this issue, the lookup should be evaluated through the class scope. ## Test Plan - Added test case from issue Co-authored-by: Igor Drokin <drokinii1017@gmail.com>
Author
Parents
Loading