File tree Expand file tree Collapse file tree 4 files changed +264
-5
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 4 files changed +264
-5
lines changed Original file line number Diff line number Diff line change @@ -281,12 +281,10 @@ class D1:
281281class D2 :
282282 x: str
283283
284- # TODO : these should not be errors
285- D1(" a" ) # error: [too-many-positional-arguments]
284+ D1(" a" )
286285D2(" a" )
287286
288- # TODO : these should be invalid-argument-type errors
289- D1(1.2 ) # error: [too-many-positional-arguments]
287+ D1(1.2 ) # error: [invalid-argument-type]
290288D2(1.2 ) # error: [invalid-argument-type]
291289```
292290
Original file line number Diff line number Diff line change @@ -811,7 +811,7 @@ impl<'db> Bindings<'db> {
811811 . overloads
812812 . iter ( )
813813 . for_each ( & mut handle_dataclass_transformer_params) ;
814- } ;
814+ }
815815
816816 handle_dataclass_transformer_params ( & function_type) ;
817817 }
Original file line number Diff line number Diff line change @@ -2099,6 +2099,17 @@ impl<'db> TypeInferenceBuilder<'db> {
20992099 }
21002100
21012101 if let Type :: FunctionLiteral ( f) = decorator_ty {
2102+ // We do not yet detect or flag `@dataclass_transformer` applied to more than one
2103+ // overload, or an overload and the implementation both. Nevertheless, this is not
2104+ // allowed. We do not try to treat the offenders intelligently -- just use the
2105+ // params of the last seen usage of `@dataclass_transformer`
2106+ if let Some ( overloaded) = f. to_overloaded ( self . db ( ) ) {
2107+ overloaded. overloads . iter ( ) . for_each ( |overload| {
2108+ if let Some ( params) = overload. dataclass_transformer_params ( self . db ( ) ) {
2109+ dataclass_params = Some ( params. into ( ) ) ;
2110+ }
2111+ } ) ;
2112+ }
21022113 if let Some ( params) = f. dataclass_transformer_params ( self . db ( ) ) {
21032114 dataclass_params = Some ( params. into ( ) ) ;
21042115 continue ;
You can’t perform that action at this time.
0 commit comments