Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/ty_python_semantic/src/types/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4213,14 +4213,14 @@ pub(crate) struct SliceLiteral {
pub(crate) step: Option<i32>,
}

impl<'db> Type<'db> {
/// If this type represents a valid slice literal, returns a [`SliceLiteral`] describing it.
impl<'db> ClassType<'db> {
/// If this class is a specialization of `slice`, returns a [`SliceLiteral`] describing it.
/// Otherwise returns `None`.
///
/// The type must be a specialization of the `slice` builtin type, where the specialized
/// typevars are statically known integers or `None`.
/// The specialization must be one in which the typevars are solved as being statically known
/// integers or `None`.
pub(crate) fn slice_literal(self, db: &'db dyn Db) -> Option<SliceLiteral> {
let ClassType::Generic(alias) = self.into_nominal_instance()?.class else {
let ClassType::Generic(alias) = self else {
return None;
};
if !alias.origin(db).is_known(db, KnownClass::Slice) {
Expand Down
Loading
Loading