From 89281f05565c6704f834e6d9ef8d235bb337f9cd Mon Sep 17 00:00:00 2001 From: David Peter Date: Thu, 20 Feb 2025 14:42:02 +0100 Subject: [PATCH] Add TODO for builtins.tuple attribute lookups --- crates/red_knot_python_semantic/src/types.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index 51162bdb69..a69c97a0e8 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -1511,7 +1511,12 @@ impl<'db> Type<'db> { // where we infer `SliceLiteral` types. Type::SliceLiteral(_) => KnownClass::Slice.to_instance(db).static_member(db, name), - Type::Tuple(_) => KnownClass::Tuple.to_instance(db).static_member(db, name), + Type::Tuple(_) => { + // TODO: We might want to special case some attributes here, as the stubs + // for `builtins.tuple` assume that `self` is a homogeneous tuple, while + // we're explicitly modeling heterogeneous tuples using `Type::Tuple`. + KnownClass::Tuple.to_instance(db).static_member(db, name) + } Type::AlwaysTruthy | Type::AlwaysFalsy => match name { "__bool__" => {