@@ -35,16 +35,49 @@ fn check_call_expr(
3535 }
3636
3737 if param. 0 == "..." {
38+ if param. 1 . is_none ( ) {
39+ break ;
40+ }
41+
42+ let param_type = param. 1 . clone ( ) . unwrap ( ) ;
43+ for arg in args. iter ( ) . skip ( idx) {
44+ let mut expr_type = semantic_model
45+ . infer_expr ( arg. clone ( ) )
46+ . unwrap_or ( LuaType :: Any ) ;
47+ // treat unknown type as any
48+ if expr_type. is_unknown ( ) {
49+ expr_type = LuaType :: Any ;
50+ }
51+
52+ if !semantic_model. check_type_compact ( & param_type, & expr_type) {
53+ let db = semantic_model. get_db ( ) ;
54+ context. add_diagnostic (
55+ DiagnosticCode :: ParamTypeNotMatch ,
56+ arg. get_range ( ) ,
57+ format ! (
58+ "expected {} but founded {}" ,
59+ humanize_type( db, & param_type) ,
60+ humanize_type( db, & expr_type)
61+ ) ,
62+ None ,
63+ ) ;
64+ }
65+ }
3866 } else {
3967 if param. 1 . is_none ( ) {
4068 continue ;
4169 }
4270
4371 let param_type = param. 1 . clone ( ) . unwrap ( ) ;
4472 let arg = & args[ idx] ;
45- let expr_type = semantic_model
73+ let mut expr_type = semantic_model
4674 . infer_expr ( arg. clone ( ) )
4775 . unwrap_or ( LuaType :: Any ) ;
76+ // treat unknown type as any
77+ if expr_type. is_unknown ( ) {
78+ expr_type = LuaType :: Any ;
79+ }
80+
4881 if !semantic_model. check_type_compact ( & param_type, & expr_type) {
4982 let db = semantic_model. get_db ( ) ;
5083 context. add_diagnostic (
0 commit comments