mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-09 21:28:04 +00:00
[ty] Make use of salsa Lookup
when interning values (#19347)
Some checks are pending
CI / mkdocs (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Some checks are pending
CI / mkdocs (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
This commit is contained in:
parent
966cc9d6e9
commit
e506296cec
4 changed files with 9 additions and 9 deletions
|
@ -2692,7 +2692,7 @@ impl ExpressionsScopeMapBuilder {
|
||||||
let mut interval_map = Vec::new();
|
let mut interval_map = Vec::new();
|
||||||
|
|
||||||
let mut current_scope = first.1;
|
let mut current_scope = first.1;
|
||||||
let mut range = first.0..=NodeIndex::from(first.0.as_u32() + 1);
|
let mut range = first.0..=first.0;
|
||||||
|
|
||||||
for (index, scope) in iter {
|
for (index, scope) in iter {
|
||||||
if scope == current_scope {
|
if scope == current_scope {
|
||||||
|
|
|
@ -3135,7 +3135,7 @@ impl<'db> Type<'db> {
|
||||||
db,
|
db,
|
||||||
"__getattr__",
|
"__getattr__",
|
||||||
CallArgumentTypes::positional([Type::StringLiteral(
|
CallArgumentTypes::positional([Type::StringLiteral(
|
||||||
StringLiteralType::new(db, Box::from(name.as_str())),
|
StringLiteralType::new(db, name.as_str()),
|
||||||
)]),
|
)]),
|
||||||
)
|
)
|
||||||
.map(|outcome| Place::bound(outcome.return_type(db)))
|
.map(|outcome| Place::bound(outcome.return_type(db)))
|
||||||
|
@ -3156,7 +3156,7 @@ impl<'db> Type<'db> {
|
||||||
db,
|
db,
|
||||||
"__getattribute__",
|
"__getattribute__",
|
||||||
&mut CallArgumentTypes::positional([Type::StringLiteral(
|
&mut CallArgumentTypes::positional([Type::StringLiteral(
|
||||||
StringLiteralType::new(db, Box::from(name.as_str())),
|
StringLiteralType::new(db, name.as_str()),
|
||||||
)]),
|
)]),
|
||||||
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
||||||
)
|
)
|
||||||
|
@ -4988,7 +4988,7 @@ impl<'db> Type<'db> {
|
||||||
);
|
);
|
||||||
Ok(Type::TypeVar(TypeVarInstance::new(
|
Ok(Type::TypeVar(TypeVarInstance::new(
|
||||||
db,
|
db,
|
||||||
ast::name::Name::new("Self"),
|
ast::name::Name::new_static("Self"),
|
||||||
Some(class.definition(db)),
|
Some(class.definition(db)),
|
||||||
Some(TypeVarBoundOrConstraints::UpperBound(instance)),
|
Some(TypeVarBoundOrConstraints::UpperBound(instance)),
|
||||||
TypeVarVariance::Invariant,
|
TypeVarVariance::Invariant,
|
||||||
|
@ -8195,7 +8195,7 @@ impl<'db> StringLiteralType<'db> {
|
||||||
pub(crate) fn iter_each_char(self, db: &'db dyn Db) -> impl Iterator<Item = Self> {
|
pub(crate) fn iter_each_char(self, db: &'db dyn Db) -> impl Iterator<Item = Self> {
|
||||||
self.value(db)
|
self.value(db)
|
||||||
.chars()
|
.chars()
|
||||||
.map(|c| StringLiteralType::new(db, c.to_string().as_str()))
|
.map(|c| StringLiteralType::new(db, c.to_string().into_boxed_str()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3502,7 +3502,7 @@ impl KnownClass {
|
||||||
Some(Type::KnownInstance(KnownInstanceType::TypeVar(
|
Some(Type::KnownInstance(KnownInstanceType::TypeVar(
|
||||||
TypeVarInstance::new(
|
TypeVarInstance::new(
|
||||||
db,
|
db,
|
||||||
target.id.clone(),
|
&target.id,
|
||||||
Some(containing_assignment),
|
Some(containing_assignment),
|
||||||
bound_or_constraint,
|
bound_or_constraint,
|
||||||
variance,
|
variance,
|
||||||
|
|
|
@ -2366,7 +2366,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||||
let function_literal =
|
let function_literal =
|
||||||
FunctionLiteral::new(self.db(), overload_literal, inherited_generic_context);
|
FunctionLiteral::new(self.db(), overload_literal, inherited_generic_context);
|
||||||
|
|
||||||
let type_mappings = Box::from([]);
|
let type_mappings = Box::default();
|
||||||
let mut inferred_ty = Type::FunctionLiteral(FunctionType::new(
|
let mut inferred_ty = Type::FunctionLiteral(FunctionType::new(
|
||||||
self.db(),
|
self.db(),
|
||||||
function_literal,
|
function_literal,
|
||||||
|
@ -3070,7 +3070,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||||
let default_ty = self.infer_optional_type_expression(default.as_deref());
|
let default_ty = self.infer_optional_type_expression(default.as_deref());
|
||||||
let ty = Type::KnownInstance(KnownInstanceType::TypeVar(TypeVarInstance::new(
|
let ty = Type::KnownInstance(KnownInstanceType::TypeVar(TypeVarInstance::new(
|
||||||
self.db(),
|
self.db(),
|
||||||
name.id.clone(),
|
&name.id,
|
||||||
Some(definition),
|
Some(definition),
|
||||||
bound_or_constraint,
|
bound_or_constraint,
|
||||||
TypeVarVariance::Invariant, // TODO: infer this
|
TypeVarVariance::Invariant, // TODO: infer this
|
||||||
|
@ -3462,7 +3462,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||||
db,
|
db,
|
||||||
"__setattr__",
|
"__setattr__",
|
||||||
&mut CallArgumentTypes::positional([
|
&mut CallArgumentTypes::positional([
|
||||||
Type::StringLiteral(StringLiteralType::new(db, Box::from(attribute))),
|
Type::StringLiteral(StringLiteralType::new(db, attribute)),
|
||||||
value_ty,
|
value_ty,
|
||||||
]),
|
]),
|
||||||
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue