Skip to content

Commit 50d8dd2

Browse files
committed
fix analysis error
1 parent f94edad commit 50d8dd2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

internal/analysis/check.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,20 @@ func (res *CheckResult) checkDuplicateVars(variableName parser.Variable, decl pa
304304
}
305305
}
306306

307-
func (res *CheckResult) checkFnCall(fnCall parser.FnCall, requiredType string) {
308-
resolution, ok := Builtins[fnCall.Caller.Name]
309-
if ok {
310-
resolution, ok := resolution.(VarOriginFnCallResolution)
311-
if ok {
307+
func (res *CheckResult) checkFnCall(fnCall parser.FnCall) string {
308+
returnType := TypeAny
309+
310+
if resolution, ok := Builtins[fnCall.Caller.Name]; ok {
311+
if resolution, ok := resolution.(VarOriginFnCallResolution); ok {
312312
res.fnCallResolution[fnCall.Caller] = resolution
313-
res.assertHasType(&fnCall, requiredType, resolution.Return)
313+
returnType = resolution.Return
314314
}
315315
}
316316

317317
// this must come after resolution
318318
res.checkFnCallArity(&fnCall)
319+
320+
return returnType
319321
}
320322

321323
func (res *CheckResult) checkExpression(lit parser.ValueExpr, requiredType string) {
@@ -381,6 +383,9 @@ func (res *CheckResult) checkTypeOf(lit parser.ValueExpr, typeHint string) strin
381383
case *parser.StringLiteral:
382384
return TypeString
383385

386+
case *parser.FnCall:
387+
return res.checkFnCall(*lit)
388+
384389
default:
385390
return TypeAny
386391
}

0 commit comments

Comments
 (0)