ruff
899a5239 - Evaluate default parameter value in enclosing scope (#12852)

Commit
1 year ago
Evaluate default parameter value in enclosing scope (#12852) ## Summary This PR fixes a bug in the semantic model where it would evaluate the default parameter value in the type parameter scope. For example, ```py def foo[T1: int](a = T1): pass ``` Here, the `T1` in `a = T1` is undefined but Ruff doesn't flag it (https://play.ruff.rs/ba2f7c2f-4da6-417e-aa2a-104aa63e6d5e). The fix here is to evaluate the default parameter value in the _enclosing_ scope instead. ## Test Plan Add a test case which includes the above code under `F821` (`undefined-name`) and validate the snapshot.
Author
Parents
Loading