Skip to content

Commit

Permalink
gen: change behavior to check by default, add --no-check
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed Jan 8, 2025
1 parent 78c7fbb commit d95913c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tl
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ local function get_args_parser()

local gen_command = parser:command("gen", "Generate a Lua file for one or more Teal files.")
gen_command:argument("file", "The Teal source file."):args("+")
gen_command:flag("-c --check", "Type check and fail on type errors.")
gen_command:flag("-c --check", "Type check and fail on type errors. This is the default."):hidden(true)
gen_command:flag("--no-check", "Do not fail on type errors, only on syntax errors.")
gen_command:flag("--keep-hashbang", "Preserve hashbang line (#!) at the top of file if present.")
gen_command:option("-o --output", "Write to <filename> instead.")
:argname("<filename>")
Expand Down Expand Up @@ -806,14 +807,14 @@ commands["gen"] = function(tlconfig, args)
check_collect(i)
end

local ok, serr, terr = report_all_errors(tlconfig, env, args["no_check"])

for _, res in ipairs(results) do
if #res.tl_result.syntax_errors == 0 then
if (not serr) and (args["no_check"] or not terr) then
write_out(tlconfig, res.tl_result, args["output"] or res.output_file, pp_opts)
end
end

local ok = report_all_errors(tlconfig, env, not args["check"])

os.exit(ok and 0 or 1)
end

Expand Down
2 changes: 1 addition & 1 deletion tl.tl
Original file line number Diff line number Diff line change
Expand Up @@ -11935,7 +11935,7 @@ do
local exp1type = self:resolve_for_call(exptypes[1], args, false)

if exp1type is PolyType then
local _r, f: Type, Type
local _r, f: Type, Variable
_r, f = self:type_check_function_call(exp1, exp1type, args, 0, exp1, {node.exps[2], node.exps[3]})
if f then
exp1type = f
Expand Down

0 comments on commit d95913c

Please sign in to comment.