You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…rward (#6527)
Fixes#6412Fixes#6453
In this PR:
* Wait until we can classify r.h.s. of an assignment as normal, type alias, named tuple etc.
* Choose the corresponding branch instead of performing all of them (as it used to be before)
* Never create (or rely on creation of) temporary `Var`s
* Add every symbol to symbol table only once (as it is done for classes)
* Don't "patch" existing symbols (with one exception for type variables, see below)
* Add and update docstrings and comments
Notes:
* I allow placeholders for type alias targets and NewTypes targets, they essentially behave as base classes. In general I make logic for type aliases and NewTypes much more similar to logic of class definitions (especially NewTypes), this allows to support a whole bunch of tricky forward references
* I don't store types with placeholders in annotations, and instead if an alias target got updated (e.g. placeholders are resolved), I set `progress=True`
Follow-ups:
* There is still a small hack to keep compatibility with old analyzer in type checker, but now it is basically "don't use binder for l.h.s. of special forms"
* Type variable declarations still have a bug that duplicate type variable definition is not reported as error, second one silently wins, this will be fixed in a separate PR
* This PR doesn't aim to fix aspects of assignment analysis related to #6422, that will be also a separate PR
Test updates:
* Add and enable more tests for type aliases and NewTypes
* Add test for cyclic definition error messages
* Change order of error messages on the same line in few tests
* Enable one test file where previously only some tests were opted in (I think it was not enabled by mistake in one of the previous PRs, I enable it here since order of errors in one test in that file is affected by this PR.)
These are used to be compatible with the old semantic analyzer.
The text was updated successfully, but these errors were encountered: