mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
[red-knot] use declared types in inference/checking (#13335)
Use declared types in inference and checking. This means several things: * Imports prefer declarations over inference, when declarations are available. * When we encounter a binding, we check that the bound value's inferred type is assignable to the live declarations of the bound symbol, if any. * When we encounter a declaration, we check that the declared type is assignable from the inferred type of the symbol from previous bindings, if any. * When we encounter a binding+declaration, we check that the inferred type of the bound value is assignable to the declared type.
This commit is contained in:
parent
d86e5ad031
commit
dcfebaa4a8
13 changed files with 876 additions and 233 deletions
|
@ -27,7 +27,9 @@ pub mod expression;
|
|||
pub mod symbol;
|
||||
mod use_def;
|
||||
|
||||
pub(crate) use self::use_def::{BindingWithConstraints, BindingWithConstraintsIterator};
|
||||
pub(crate) use self::use_def::{
|
||||
BindingWithConstraints, BindingWithConstraintsIterator, DeclarationsIterator,
|
||||
};
|
||||
|
||||
type SymbolMap = hashbrown::HashMap<ScopedSymbolId, (), ()>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue