File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,9 @@ def expects_named_tuple(x: typing.NamedTuple):
312
312
313
313
def _ (y : type[typing.NamedTuple]):
314
314
reveal_type(y) # revealed: @Todo(unsupported type[X] special form)
315
+
316
+ # error: [invalid-type-form] "Special form `typing.NamedTuple` expected no type parameter"
317
+ def _ (z : typing.NamedTuple[int ]): ...
315
318
```
316
319
317
320
Any instance of a ` NamedTuple ` class can therefore be passed for a function parameter that is
Original file line number Diff line number Diff line change @@ -10783,7 +10783,8 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
10783
10783
SpecialFormType :: TypingSelf
10784
10784
| SpecialFormType :: TypeAlias
10785
10785
| SpecialFormType :: TypedDict
10786
- | SpecialFormType :: Unknown => {
10786
+ | SpecialFormType :: Unknown
10787
+ | SpecialFormType :: NamedTuple => {
10787
10788
self . infer_type_expression ( arguments_slice) ;
10788
10789
10789
10790
if let Some ( builder) = self . context . report_lint ( & INVALID_TYPE_FORM , subscript) {
@@ -10808,7 +10809,7 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
10808
10809
SpecialFormType :: Tuple => {
10809
10810
Type :: tuple ( self . infer_tuple_type_expression ( arguments_slice) )
10810
10811
}
10811
- SpecialFormType :: Generic | SpecialFormType :: Protocol | SpecialFormType :: NamedTuple => {
10812
+ SpecialFormType :: Generic | SpecialFormType :: Protocol => {
10812
10813
self . infer_expression ( arguments_slice) ;
10813
10814
if let Some ( builder) = self . context . report_lint ( & INVALID_TYPE_FORM , subscript) {
10814
10815
builder. into_diagnostic ( format_args ! (
You can’t perform that action at this time.
0 commit comments