fix: handle semantic flow edge cases#1086
Conversation
Use key type compatibility for dynamic array indexes so integer and numeric union aliases behave like their base key domains. This keeps undefined-field diagnostics quiet for valid array access and preserves strict array fallback inference. Assisted-by: Codex
Bind exhausted generic vararg templates to an empty sequence instead of one nil slot. This keeps calls like assert(value) from looking like they return an extra value when no varargs were passed. Assisted-by: Codex
Treat functions as satisfying @return when every reachable path either returns or cannot terminate. Only report missing-return when a path can leave the function body without returning. Assisted-by: Codex
Allow callable return inference to run with empty forwarded args, and infer forwarded call arguments through the no-flow table-literal overlay when matching generic callback parameters. This lets guarded pcall-style helpers infer callback results for zero-arg, forwarded-arg, and direct table-literal calls without retaining the non-callable union member. Assisted-by: Codex
Flow RHS replay only walked direct LuaExpr children, so call arguments hidden under LuaCallArgList missed flow-aware overlays. That made assignments like a = assert(arr[i]) lose the narrowed index type and report table return fields as nil. Assisted-by: Codex
Replay call condition result types when the call itself does not narrow the queried variable, so always truthy/falsy returns can remove unreachable condition branches. Assisted-by: Codex
Code Review SummaryChanges OverviewThis PR modifies the return type of Issues Found1. Inconsistent Function Signature Across Files
2. Potential Logic Regression in
|
There was a problem hiding this comment.
Code Review
This pull request refactors the function body analysis by removing the is_infinite flag from return flag tracking, simplifying the logic for detecting missing return statements. It also improves type inference for pcall return values, array indexing with integer literal unions, and variadic generic parameters, specifically handling empty vararg sequences more accurately. Additionally, the PR enhances flow-sensitive type narrowing for call expressions and adds comprehensive test cases for these scenarios. I have no feedback to provide as there were no review comments.
Problem:
Solution:
Testing: