mirror of https://github.com/astral-sh/ruff
revert unnecessary changes
This commit is contained in:
parent
39a528ed17
commit
505dcc81ac
|
|
@ -184,21 +184,19 @@ static PYDANTIC: Benchmark = Benchmark::new(
|
|||
7000,
|
||||
);
|
||||
|
||||
static SYMPY: std::sync::LazyLock<Benchmark<'static>> = std::sync::LazyLock::new(|| {
|
||||
Benchmark::new(
|
||||
RealWorldProject {
|
||||
name: "sympy",
|
||||
repository: "https://github.com/sympy/sympy",
|
||||
commit: "22fc107a94eaabc4f6eb31470b39db65abb7a394",
|
||||
paths: &["sympy"],
|
||||
dependencies: &["mpmath"],
|
||||
max_dep_date: "2025-06-17",
|
||||
python_version: PythonVersion::PY312,
|
||||
},
|
||||
// TODO: With better decorator support, `__slots__` support, etc., it should be possible to reduce the number of errors considerably.
|
||||
70000,
|
||||
)
|
||||
});
|
||||
static SYMPY: Benchmark = Benchmark::new(
|
||||
RealWorldProject {
|
||||
name: "sympy",
|
||||
repository: "https://github.com/sympy/sympy",
|
||||
commit: "22fc107a94eaabc4f6eb31470b39db65abb7a394",
|
||||
paths: &["sympy"],
|
||||
dependencies: &["mpmath"],
|
||||
max_dep_date: "2025-06-17",
|
||||
python_version: PythonVersion::PY312,
|
||||
},
|
||||
// TODO: With better decorator support, `__slots__` support, etc., it should be possible to reduce the number of errors considerably.
|
||||
70000,
|
||||
);
|
||||
|
||||
static TANJUN: Benchmark = Benchmark::new(
|
||||
RealWorldProject {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ use compact_str::{CompactString, ToCompactString};
|
|||
use infer::nearest_enclosing_class;
|
||||
use itertools::{Either, Itertools};
|
||||
use ruff_diagnostics::{Edit, Fix};
|
||||
use ruff_python_ast::name::Name;
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::time::Duration;
|
||||
|
|
@ -17,7 +15,9 @@ use ruff_db::diagnostic::{Annotation, Diagnostic, Span, SubDiagnostic, SubDiagno
|
|||
use ruff_db::files::File;
|
||||
use ruff_db::parsed::parsed_module;
|
||||
use ruff_python_ast as ast;
|
||||
use ruff_python_ast::name::Name;
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
use type_ordering::union_or_intersection_elements_ordering;
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ pub(crate) fn infer_expression_types<'db>(
|
|||
infer_expression_types_impl(db, InferExpression::new(db, expression, tcx))
|
||||
}
|
||||
|
||||
/// When using types in [`ExpressionInference`], you must use [`ExpressionInference::cycle_recovery`].
|
||||
#[salsa::tracked(returns(ref), cycle_fn=expression_cycle_recover, cycle_initial=expression_cycle_initial, heap_size=ruff_memory_usage::heap_size)]
|
||||
pub(super) fn infer_expression_types_impl<'db>(
|
||||
db: &'db dyn Db,
|
||||
|
|
@ -824,13 +823,6 @@ impl<'db> DefinitionInference<'db> {
|
|||
self.extra.as_ref().and_then(|extra| extra.cycle_recovery)
|
||||
}
|
||||
|
||||
/// When using `DefinitionInference` during type inference,
|
||||
/// use this method to get the cycle recovery type so that divergent types are propagated.
|
||||
#[allow(unused)]
|
||||
pub(super) fn cycle_recovery(&self) -> Option<Type<'db>> {
|
||||
self.fallback_type()
|
||||
}
|
||||
|
||||
pub(crate) fn undecorated_type(&self) -> Option<Type<'db>> {
|
||||
self.extra.as_ref().and_then(|extra| extra.undecorated_type)
|
||||
}
|
||||
|
|
@ -933,13 +925,6 @@ impl<'db> ExpressionInference<'db> {
|
|||
self.extra.as_ref().and_then(|extra| extra.cycle_recovery)
|
||||
}
|
||||
|
||||
/// When using `ExpressionInference` during type inference,
|
||||
/// use this method to get the cycle recovery type so that divergent types are propagated.
|
||||
#[allow(unused)]
|
||||
pub(super) fn cycle_recovery(&self) -> Option<Type<'db>> {
|
||||
self.fallback_type()
|
||||
}
|
||||
|
||||
/// Returns true if all places in this expression are definitely bound.
|
||||
pub(crate) fn all_places_definitely_bound(&self) -> bool {
|
||||
self.extra
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ enum IntersectionOn {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
pub(super) struct TypeAndRange<'db> {
|
||||
struct TypeAndRange<'db> {
|
||||
ty: Type<'db>,
|
||||
range: TextRange,
|
||||
}
|
||||
|
|
@ -8432,7 +8432,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
|||
|
||||
// Special handling for `TypedDict` method calls
|
||||
if let ast::Expr::Attribute(ast::ExprAttribute { value, attr, .. }) = func.as_ref() {
|
||||
let value_type = self.expression_type(value.as_ref());
|
||||
let value_type = self.expression_type(value);
|
||||
if let Type::TypedDict(typed_dict_ty) = value_type {
|
||||
if matches!(attr.id.as_str(), "pop" | "setdefault") && !arguments.args.is_empty() {
|
||||
// Validate the key argument for `TypedDict` methods
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
|
|||
// we do not store types for sub-expressions. Re-infer the type here.
|
||||
builder.infer_expression(value, TypeContext::default())
|
||||
} else {
|
||||
builder.expression_type(value.as_ref())
|
||||
builder.expression_type(value)
|
||||
};
|
||||
|
||||
value_ty == Type::SpecialForm(SpecialFormType::Unpack)
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ impl<'a, 'db> ProtocolMember<'a, 'db> {
|
|||
self.qualifiers
|
||||
}
|
||||
|
||||
pub(super) fn ty(&self) -> Type<'db> {
|
||||
fn ty(&self) -> Type<'db> {
|
||||
match &self.kind {
|
||||
ProtocolMemberKind::Method(callable) => Type::Callable(*callable),
|
||||
ProtocolMemberKind::Property(property) => Type::PropertyInstance(*property),
|
||||
|
|
|
|||
Loading…
Reference in New Issue