From 7d7a3a883cbd5e30cfc0e92f07059c7767e06b39 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 27 Nov 2025 17:41:51 +0000 Subject: [PATCH] cleanup --- .../resources/mdtest/classes.md | 19 +++++++++++++++++++ crates/ty_python_semantic/src/types/infer.rs | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/ty_python_semantic/resources/mdtest/classes.md b/crates/ty_python_semantic/resources/mdtest/classes.md index 4d92cb9cdf..e4ed634c49 100644 --- a/crates/ty_python_semantic/resources/mdtest/classes.md +++ b/crates/ty_python_semantic/resources/mdtest/classes.md @@ -25,3 +25,22 @@ B = bytes reveal_mro(C) # revealed: (, , , typing.Generic, ) ``` + +## Starred bases + +These are currently not supported, but ideally we would support them in some limited situations. + +```py +from ty_extensions import reveal_mro + +class A: ... +class B: ... +class C: ... + +bases = (A, B, C) + +class Foo(*bases): ... + +# revealed: (, @Todo(Starred expressions in class bases), ) +reveal_mro(Foo) +``` diff --git a/crates/ty_python_semantic/src/types/infer.rs b/crates/ty_python_semantic/src/types/infer.rs index e4903da824..9bc72c172d 100644 --- a/crates/ty_python_semantic/src/types/infer.rs +++ b/crates/ty_python_semantic/src/types/infer.rs @@ -386,6 +386,8 @@ impl<'db> TypeContext<'db> { .is_some_and(|ty| ty.is_typealias_special_form()) } + // TODO: we could just always use `Iterable[]` + // as the type context once is fixed. pub(crate) fn for_starred_expression( db: &'db dyn Db, expected_element_type: Type<'db>, @@ -401,8 +403,6 @@ impl<'db> TypeContext<'db> { ast::Expr::Tuple(_) => { Self::new(Some(Type::homogeneous_tuple(db, expected_element_type))) } - // `Iterable[]` would work well for an arbitrary other node - // if is implemented. _ => Self::default(), } }