mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-10 05:38:15 +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 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 {
|
||||
if scope == current_scope {
|
||||
|
|
|
@ -3135,7 +3135,7 @@ impl<'db> Type<'db> {
|
|||
db,
|
||||
"__getattr__",
|
||||
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)))
|
||||
|
@ -3156,7 +3156,7 @@ impl<'db> Type<'db> {
|
|||
db,
|
||||
"__getattribute__",
|
||||
&mut CallArgumentTypes::positional([Type::StringLiteral(
|
||||
StringLiteralType::new(db, Box::from(name.as_str())),
|
||||
StringLiteralType::new(db, name.as_str()),
|
||||
)]),
|
||||
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
||||
)
|
||||
|
@ -4988,7 +4988,7 @@ impl<'db> Type<'db> {
|
|||
);
|
||||
Ok(Type::TypeVar(TypeVarInstance::new(
|
||||
db,
|
||||
ast::name::Name::new("Self"),
|
||||
ast::name::Name::new_static("Self"),
|
||||
Some(class.definition(db)),
|
||||
Some(TypeVarBoundOrConstraints::UpperBound(instance)),
|
||||
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> {
|
||||
self.value(db)
|
||||
.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(
|
||||
TypeVarInstance::new(
|
||||
db,
|
||||
target.id.clone(),
|
||||
&target.id,
|
||||
Some(containing_assignment),
|
||||
bound_or_constraint,
|
||||
variance,
|
||||
|
|
|
@ -2366,7 +2366,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
|||
let function_literal =
|
||||
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(
|
||||
self.db(),
|
||||
function_literal,
|
||||
|
@ -3070,7 +3070,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
|||
let default_ty = self.infer_optional_type_expression(default.as_deref());
|
||||
let ty = Type::KnownInstance(KnownInstanceType::TypeVar(TypeVarInstance::new(
|
||||
self.db(),
|
||||
name.id.clone(),
|
||||
&name.id,
|
||||
Some(definition),
|
||||
bound_or_constraint,
|
||||
TypeVarVariance::Invariant, // TODO: infer this
|
||||
|
@ -3462,7 +3462,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
|||
db,
|
||||
"__setattr__",
|
||||
&mut CallArgumentTypes::positional([
|
||||
Type::StringLiteral(StringLiteralType::new(db, Box::from(attribute))),
|
||||
Type::StringLiteral(StringLiteralType::new(db, attribute)),
|
||||
value_ty,
|
||||
]),
|
||||
MemberLookupPolicy::MRO_NO_OBJECT_FALLBACK,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue