@@ -101,7 +101,20 @@ fn check_call_expr(
101
101
102
102
match param_type {
103
103
LuaType :: StrTplRef ( str_tpl_ref) => {
104
- check_str_tpl_ref ( context, semantic_model, & call_expr, i, str_tpl_ref) ;
104
+ let extend_type = get_extend_type (
105
+ semantic_model,
106
+ & call_expr,
107
+ str_tpl_ref. get_tpl_id ( ) ,
108
+ signature,
109
+ ) ;
110
+ check_str_tpl_ref (
111
+ context,
112
+ semantic_model,
113
+ & call_expr,
114
+ i,
115
+ str_tpl_ref,
116
+ extend_type,
117
+ ) ;
105
118
}
106
119
LuaType :: TplRef ( tpl_ref) => {
107
120
let extend_type = get_extend_type (
@@ -161,10 +174,12 @@ fn check_str_tpl_ref(
161
174
call_expr : & LuaCallExpr ,
162
175
param_index : usize ,
163
176
str_tpl_ref : & LuaStringTplType ,
177
+ extend_type : Option < LuaType > ,
164
178
) -> Option < ( ) > {
165
179
let arg_expr = call_expr. get_args_list ( ) ?. get_args ( ) . nth ( param_index) ?;
166
180
let arg_type = semantic_model. infer_expr ( arg_expr. clone ( ) ) . ok ( ) ?;
167
181
let range = arg_expr. get_range ( ) ;
182
+
168
183
match arg_type {
169
184
LuaType :: StringConst ( str) | LuaType :: DocStringConst ( str) => {
170
185
let full_type_name = format ! (
@@ -185,6 +200,25 @@ fn check_str_tpl_ref(
185
200
None ,
186
201
) ;
187
202
}
203
+
204
+ if let Some ( extend_type) = extend_type {
205
+ if !extend_type. is_string ( ) {
206
+ if let Some ( type_decl) = founded_type_decl {
207
+ let type_id = type_decl. get_id ( ) ;
208
+ let ref_type = LuaType :: Ref ( type_id) ;
209
+ let result = semantic_model. type_check ( & extend_type, & ref_type) ;
210
+ if result. is_err ( ) {
211
+ add_type_check_diagnostic (
212
+ context,
213
+ semantic_model,
214
+ range,
215
+ & extend_type,
216
+ result,
217
+ ) ;
218
+ }
219
+ }
220
+ }
221
+ }
188
222
}
189
223
LuaType :: String | LuaType :: Any | LuaType :: Unknown => { }
190
224
_ => {
0 commit comments