Fix resolution of ParamSpec in circular dependencies
What's happening here?
We load module bar, by requesting it from the loader.
Before resolving types, we need to load its dependencies. So we load module foo.
We'd like to load foo's dependencies, but that's bar and that's a circle, so we start resolving types in foo.
When resolving external types we create alias an foo.bar, copying the unresolved signature from bar.bar.
When resolving local types, _P is not resolvable within foo.
We run visitors.AdjustTypeParameters, which seems to require local type resolution, and runs afterwards. It declares _P in foo. Now _P.args would be resolvable but we already finished resolving local types and we don't do it again.
We resolve types in bar, validate bar's AST and return.
We load module foo, by requesting it from the loader.
It's cached. We just need to validate it. We realize that types aren't resolved, yet, e.g. _P.args. We used to do only external type resolution again, which did not resolve ParamSpec, and we eventually bailed. This change also adds local type resolution again, which does resolve ParamSpec.
Fix resolution of ParamSpec in circular dependencies
What's happening here?
bar
, by requesting it from the loader.foo
.foo
's dependencies, but that'sbar
and that's a circle, so we start resolving types infoo
.foo.bar
, copying the unresolved signature frombar.bar
._P
is not resolvable withinfoo
.visitors.AdjustTypeParameters
, which seems to require local type resolution, and runs afterwards. It declares_P
infoo
. Now_P.args
would be resolvable but we already finished resolving local types and we don't do it again.bar
, validatebar
's AST and return.foo
, by requesting it from the loader._P.args
. We used to do only external type resolution again, which did not resolve ParamSpec, and we eventually bailed. This change also adds local type resolution again, which does resolve ParamSpec.