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
Maybe we code like this shouldn't generate an error when using --allow-redefinition:
x: List[int] = []
# do something with xx= [] # Error: need annotation
The reason for the error is that the second assignment creates a completely independent variable, so the type of the original definition has no effect.
There are still some open issues:
Using the context can generate false positives, in case the correct type would be something different for the second definition. I don't know how often this would be an issue.
Propagating the type context is somewhat tricky since the name of the previous definition is not trivial to calculate. The rules for renaming depend on the scope (local/class/global).
If/when we support more general redefinitions (not just within a single block), it may be unclear when we should propagate context. It may be best to first to make redefinitions more general and then reconsider this issue.
Maybe we code like this shouldn't generate an error when using
--allow-redefinition
:The reason for the error is that the second assignment creates a completely independent variable, so the type of the original definition has no effect.
There are still some open issues:
Follow-up to #6197.
The text was updated successfully, but these errors were encountered: