You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ ./emmylua_check .
--- main.lua [1 warning]
warning: expected `integer` but found `integer?`. [param-type-mismatch]
-->: main.lua:19:12
18 │ end
19 │ accept_num(num1)
20 │
Summary
1 warning
Check completed with warnings
Check finished
num2 worked as expected - using the builtin error when its nil convinced the type checker that it cannot be nil. But why does it think num1 is still an integer?? I've annotated my panic() as ---@return never, which - in any language that has a never type - means it can never return (either by looping forever, by throwing an error, or by crashing the program itself via whatever means), and therefore the type checker should consider it equivalent to calling error() and conclude the num1 is integer and not integer? after that check. But it doesn't.
Activity
CppCXY commentedon Dec 9, 2025
you can config like:
{ "runtime": { "special": { "panic" : "error" }, "version": "LuaLatest" } }In the current control-flow analysis we assume our type analysis is not yet complete, so we can't make use of that information.
idanarye commentedon Dec 9, 2025
What's the purpose of the
nevertype, then?xuhuanzy commentedon Dec 9, 2025
neveris currently equivalent tonilxuhuanzy commentedon Jun 20, 2026
I think it's now possible to support this issue to a limited extent.
feat(flow): return `never` is considered an unreachable branch.
xuhuanzy commentedon Jun 21, 2026
Added a rough implementation without performing detailed control flow analysis.
fix: separate unreachable conditions from never types
fix: separate unreachable conditions from never types