ruff
125eaafa - [red-knot] inferred type, not Unknown, for undeclared paths (#13400)

Commit
1 year ago
[red-knot] inferred type, not Unknown, for undeclared paths (#13400) After looking at more cases (for example, the case in the added test in this PR), I realized that our previous rule, "if a symbol has any declarations, use only declarations for its public type" is not adequate. Rather than using `Unknown` as fallback if the symbol is not declared in some paths, we need to use the inferred type as fallback in that case. For the paths where the symbol _was_ declared, we know that any bindings must be assignable to the declared type in that path, so this won't change the overall declared type in those paths. But for paths where the symbol wasn't declared, this will give us a better type in place of `Unknown`.
Author
Parents
Loading