diff options
| author | Vincent Laviron <vincent.laviron@gmail.com> | 2022-10-02 00:16:51 +0200 |
|---|---|---|
| committer | Vincent Laviron <vincent.laviron@gmail.com> | 2022-10-02 00:16:51 +0200 |
| commit | f7041e94c23c327cbb07d57495d067048a9ec4ec (patch) | |
| tree | 380d87831061a762467a30c743c8185731620ba6 /lambda | |
| parent | 0558a3bf3f777430b1cddcf013bf332ba2b1da3b (diff) | |
| download | ocaml-f7041e94c23c327cbb07d57495d067048a9ec4ec.tar.gz | |
Review
Diffstat (limited to 'lambda')
| -rw-r--r-- | lambda/matching.ml | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lambda/matching.ml b/lambda/matching.ml index fd564f68e6..a155076b11 100644 --- a/lambda/matching.ml +++ b/lambda/matching.ml @@ -2946,15 +2946,14 @@ let combine_variant loc row arg partial ctx def (tag_lambda_list, total1, _pats) match (consts, nonconsts) with | [ (_, act1) ], [ (_, act2) ] when fail = None -> test_int_or_block arg act1 act2 - | _, [] -> - begin match fail with - | None -> - make_test_sequence_variant_constant fail arg consts - | Some act -> - test_int_or_block arg - (make_test_sequence_variant_constant fail arg consts) - act - end + | _, [] -> ( + let lam = make_test_sequence_variant_constant fail arg consts in + (* PR#11587: Switcher.test_sequence expects integer inputs, so + if the type allows pointers we must filter them away. *) + match fail with + | None -> lam + | Some fail -> test_int_or_block arg lam fail + ) | [], _ -> ( let lam = call_switcher_variant_constr loc fail arg nonconsts in (* One must not dereference integers *) |
