From 775ceda5ed0b727df6572d9174544f28aa5843d1 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 5 Sep 2024 01:00:35 -0300 Subject: [PATCH] funcall: minor simplification --- tl.lua | 12 ++++++------ tl.tl | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tl.lua b/tl.lua index 0292b3bcb..989ecf2b8 100644 --- a/tl.lua +++ b/tl.lua @@ -9277,9 +9277,7 @@ a.types[i], b.types[i]), } infer_emptytables(self, w, where_args, args, f.args, argdelta) - mark_invalid_typeargs(self, f) - - return self:resolve_typevars_at(w, f.rets) + return f.rets end end @@ -9335,9 +9333,7 @@ a.types[i], b.types[i]), } local f = resolve_function_type(func, 1) - mark_invalid_typeargs(self, f) - - return self:resolve_typevars_at(w, f.rets) + return f.rets end local function check_call(self, w, where_args, func, args, expected_rets, is_typedecl_funcall, argdelta) @@ -9449,6 +9445,10 @@ a.types[i], b.types[i]), } local ret, f = check_call(self, node, e2, func, args, expected_rets, is_typedecl_funcall, argdelta or 0) + if f then + mark_invalid_typeargs(self, f) + end + ret = self:resolve_typevars_at(node, ret) self:end_scope() diff --git a/tl.tl b/tl.tl index 235a018d0..dbc702c30 100644 --- a/tl.tl +++ b/tl.tl @@ -9277,9 +9277,7 @@ do infer_emptytables(self, w, where_args, args, f.args, argdelta) - mark_invalid_typeargs(self, f) - - return self:resolve_typevars_at(w, f.rets) + return f.rets end end @@ -9335,9 +9333,7 @@ do local f = resolve_function_type(func, 1) - mark_invalid_typeargs(self, f) - - return self:resolve_typevars_at(w, f.rets) + return f.rets end local function check_call(self: TypeChecker, w: Where, where_args: {Node}, func: Type, args: TupleType, expected_rets: TupleType, is_typedecl_funcall: boolean, argdelta: integer): InvalidOrTupleType, FunctionType @@ -9449,6 +9445,10 @@ do local ret, f = check_call(self, node, e2, func, args, expected_rets, is_typedecl_funcall, argdelta or 0) + if f then + mark_invalid_typeargs(self, f) + end + ret = self:resolve_typevars_at(node, ret) self:end_scope()