Commit Graph

6 Commits

Author SHA1 Message Date
Hamish Knight
27995eed19 [Completion] Type-check parent closures for local functions
Local functions can capture variables from parent
closures, so we need to make sure we type-check
parent closures when doing completion in a local
function. Ideally we ought to be able to be more
selective about the elements of the parent closure
that we type-check, but that's a more complex change
I'm leaving as future work for now.
2024-11-11 19:34:21 +00:00
Hamish Knight
0a71a90af1 [test] Switch to %batch-code-completion in a few tests 2024-06-08 11:50:19 +01:00
Hamish Knight
f4b928fd0a Remove FindLocalVal
Replace with an ASTScope lookup. This also lets
us simplify UsableFilteringDeclConsumer, and fixes
a couple of completion bugs.
2024-02-07 23:02:37 +00:00
Hamish Knight
c48b77f486 [CodeComplete] Don't skip single-expression AssignExpr bodies of an if/switch expr
Fix an issue uncovered by the stress tester where
the brace element skipping logic could still attempt
to skip a single-expression body of an if/switch
expr.
2023-08-01 15:21:30 +01:00
Hamish Knight
1dd86fccdb [CodeComplete] More efficient skipping for completions in if/switch exprs
Skip type-checking multi-statement branches if the
completion is in a single-expression branch, and
skip type-checking the expression as a whole if
the completion is in a multi-statement branch.
2023-08-01 15:21:29 +01:00
Hamish Knight
d8d8db987b [CodeComplete] Properly handle if/switch exprs
Run PreCheckFunctionBodyRequest to ensure we insert
an implicit return for an if/switch if needed, and
ensure we don't try and type-check an element in a
SingleValueStmtExpr separately, as it should be
type-checked as a whole by the constraint system.
This ensures we can propagate a contextual type from
outside an if/switch expression for code completion.
2023-08-01 15:21:29 +01:00