Skip to content

Commit 0d50952

Browse files
committed
Use Tuple/Dict for more precise parameter types
1 parent 8e193be commit 0d50952

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/red_knot_python_semantic/resources/mdtest/call/builtins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class Base: ...
5151
# error: [no-matching-overload] "No overload of class `type` matches arguments"
5252
type(b"Foo", (), {})
5353

54-
# TODO: this should be an error
55-
type("Foo", str, {})
54+
# error: [no-matching-overload] "No overload of class `type` matches arguments"
55+
type("Foo", Base, {})
5656

5757
# TODO: this should be an error
5858
type("Foo", (1, 2), {})

crates/red_knot_python_semantic/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,10 +2907,10 @@ impl<'db> Type<'db> {
29072907
.with_annotated_type(KnownClass::Str.to_instance(db)),
29082908
Parameter::positional_only(Some(Name::new_static("bases")))
29092909
// TODO: Should be tuple[type, ...] once we have support for homogenous tuples
2910-
.with_annotated_type(Type::any()),
2910+
.with_annotated_type(KnownClass::Tuple.to_instance(db)),
29112911
Parameter::positional_only(Some(Name::new_static("dict")))
29122912
// TODO: Should be `dict[str, Any]` once we have support for generics
2913-
.with_annotated_type(Type::any()),
2913+
.with_annotated_type(KnownClass::Dict.to_instance(db)),
29142914
]),
29152915
Some(KnownClass::Type.to_instance(db)),
29162916
),

0 commit comments

Comments
 (0)