mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
[red-knot] Use Unknown | T_inferred
for undeclared public symbols (#15674)
## Summary Use `Unknown | T_inferred` as the type for *undeclared* public symbols. ## Test Plan - Updated existing tests - New test for external `__slots__` modifications. - New tests for external modifications of public symbols.
This commit is contained in:
parent
7778d1d646
commit
1feb3cf41a
23 changed files with 212 additions and 91 deletions
|
@ -85,6 +85,14 @@ impl<'db> Symbol<'db> {
|
|||
Symbol::Unbound => self,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn map_type(self, f: impl FnOnce(Type<'db>) -> Type<'db>) -> Symbol<'db> {
|
||||
match self {
|
||||
Symbol::Type(ty, boundness) => Symbol::Type(f(ty), boundness),
|
||||
Symbol::Unbound => Symbol::Unbound,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue