Repository navigation
fix(flow): avoid unresolved global replay hang - #1072
Conversation
Code ReviewIssues Found:
Recommendations:
// Add a recursion depth check or visited set
if self.recursion_depth > MAX_RECURSION_DEPTH {
return Err(InferFailReason::RecursiveInfer);
}
if query.var_ref_id.get_decl_id_ref()
.and_then(|decl_id| self.db.get_decl_index().get_decl(&decl_id))
.is_some_and(|decl| decl.is_global())
{
let result = get_var_ref_type(self.db, self.cache, &query.var_ref_id);
// Still need to insert cache entry even if result is error
get_flow_var_cache(self.cache, query.var_cache_idx)
.type_cache
.insert(type_cache_key, CacheEntry::Ready);
result?;
}
|
There was a problem hiding this comment.
Code Review
This pull request addresses performance issues and potential hangs during type inference by handling unresolved globals more efficiently in the flow-type engine. It also adds a regression test for issue #1071 involving complex arithmetic operations. Feedback was provided to optimize the global check by returning early, which would skip the flow walk entirely and prevent redundant sub-queries in deep assignment chains.
Unresolved globals are handled by the global unresolve pass. Avoid walking their flow queries during indexing so repeated self-assignments do not scan the whole assignment chain before the global type cache is resolved. Resolves EmmyLuaLs#1071 Assisted-by: Codex
28c1bfd to
afe9127
Compare
|
/review |
Code ReviewIssues Found:
Recommendations:
|
|
I'm not sure these copilot reviews are any good. The gemini ones are much better:
|
Not Copilot, just a simple check using the flash version of DeepSeek. That it's very cheap. Currently, the average cost per review is only 0.001$. |
skip flow walking unresolved global queries so the existing global unresolve pass can handle them
Resolves #1071