Skip to content

Commit 54c44b2

Browse files
committed
missed traversing switch expr when no cases
1 parent a14eb86 commit 54c44b2

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

analysis/src/CompletionFrontEnd.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
780780
in
781781
typedCompletionExpr expr;
782782
match expr.pexp_desc with
783-
| Pexp_match (_expr, []) -> ()
784-
| Pexp_match (expr, cases) ->
783+
| Pexp_match (expr, cases) when cases <> [] ->
785784
let ctxPath = exprToContextPath expr in
786785
let oldCtxPath = !currentCtxPath in
787786
cases

analysis/tests/src/expected/CompletionFunctionArguments.res.txt

+17-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,23 @@ Complete src/CompletionFunctionArguments.res 21:27
5757
posCursor:[21:27] posNoWhite:[21:26] Found expr:[19:8->25:1]
5858
Pexp_apply ...[19:8->19:14] (~isOn20:3->20:7=...[21:7->23:8])
5959
posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:7->23:8]
60-
posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:7->23:8]
61-
[]
60+
posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:7->21:28]
61+
posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:14->21:28]
62+
Pexp_apply ...[21:14->21:20] (~isOn21:22->21:26=...__ghost__[0:-1->0:-1])
63+
Completable: Cexpression CArgument Value[someFn](~isOn)
64+
[{
65+
"label": "true",
66+
"kind": 4,
67+
"tags": [],
68+
"detail": "bool",
69+
"documentation": null
70+
}, {
71+
"label": "false",
72+
"kind": 4,
73+
"tags": [],
74+
"detail": "bool",
75+
"documentation": null
76+
}]
6277

6378
Complete src/CompletionFunctionArguments.res 34:24
6479
posCursor:[34:24] posNoWhite:[34:23] Found expr:[34:11->34:25]

analysis/tests/src/expected/CompletionPattern.res.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Complete src/CompletionPattern.res 7:13
2-
XXX Not found!
2+
posCursor:[7:13] posNoWhite:[7:12] Found expr:[7:3->7:13]
33
[]
44

55
Complete src/CompletionPattern.res 10:15

0 commit comments

Comments
 (0)