[ty] Rename `types::liskov` to `types::overrides` (#21694)

This commit is contained in:
Alex Waygood 2025-11-29 14:54:00 +00:00 committed by GitHub
parent d40590c8f9
commit 69ace00210
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View File

@ -96,11 +96,11 @@ mod generics;
pub mod ide_support;
mod infer;
mod instance;
mod liskov;
mod member;
mod mro;
mod narrow;
mod newtype;
mod overrides;
mod protocol_class;
mod signatures;
mod special_form;

View File

@ -18,7 +18,7 @@ use crate::types::class::{
CodeGeneratorKind, DisjointBase, DisjointBaseKind, Field, MethodDecorator,
};
use crate::types::function::{FunctionDecorators, FunctionType, KnownFunction, OverloadLiteral};
use crate::types::liskov::MethodKind;
use crate::types::overrides::MethodKind;
use crate::types::string_annotation::{
BYTE_STRING_TYPE_ANNOTATION, ESCAPE_CHARACTER_IN_FORWARD_ANNOTATION, FSTRING_TYPE_ANNOTATION,
IMPLICIT_CONCATENATED_STRING_TYPE_ANNOTATION, INVALID_SYNTAX_IN_FORWARD_ANNOTATION,

View File

@ -109,7 +109,7 @@ use crate::types::{
Truthiness, Type, TypeAliasType, TypeAndQualifiers, TypeContext, TypeQualifiers,
TypeVarBoundOrConstraints, TypeVarBoundOrConstraintsEvaluation, TypeVarDefaultEvaluation,
TypeVarIdentity, TypeVarInstance, TypeVarKind, TypeVarVariance, TypedDictType, UnionBuilder,
UnionType, UnionTypeInstance, binding_type, infer_scope_types, liskov, todo_type,
UnionType, UnionTypeInstance, binding_type, infer_scope_types, overrides, todo_type,
};
use crate::types::{ClassBase, add_inferred_python_version_hint_to_diagnostic};
use crate::unpack::{EvaluationMode, UnpackPosition};
@ -972,8 +972,9 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
}
}
// (8) Check for Liskov violations
liskov::check_class(&self.context, class);
// (8) Check for violations of the Liskov Substitution Principle,
// and for violations of other rules relating to invalid overrides of some sort.
overrides::check_class(&self.context, class);
if let Some(protocol) = class.into_protocol_class(self.db()) {
protocol.validate_members(&self.context);

View File

@ -1,4 +1,5 @@
//! Checks relating to the [Liskov Substitution Principle].
//! Checks relating to invalid method overrides in subclasses,
//! including (but not limited to) violations of the [Liskov Substitution Principle].
//!
//! [Liskov Substitution Principle]: https://en.wikipedia.org/wiki/Liskov_substitution_principle