Skip to content

Commit

Permalink
refactor to sync Pexp_match and pg type approx
Browse files Browse the repository at this point in the history
  • Loading branch information
rajgodse committed Jul 31, 2023
1 parent 7e4b140 commit e3d7c76
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ocaml/typing/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3731,8 +3731,8 @@ and type_approx_aux env sexp in_function ty_expected =
| Pexp_function ({pc_rhs}::_) ->
type_function_approx env sexp.pexp_loc Nolabel None pc_rhs
in_function ty_expected
| Pexp_match (_, {pc_rhs}::_) ->
type_approx_aux_case_rhs env pc_rhs None ty_expected
| Pexp_match (_, cases) ->
type_approx_aux_cases env cases None ty_expected
| Pexp_try (e, _) -> type_approx_aux env e None ty_expected
| Pexp_tuple l ->
let tys = List.map
Expand Down Expand Up @@ -3779,10 +3779,13 @@ and type_approx_aux_case_rhs env rhs in_function ty_expected =
| Psimple_rhs e | Pboolean_guarded_rhs { pbg_rhs = e; _ } ->
type_approx_aux env e in_function ty_expected
| Ppattern_guarded_rhs { ppg_cases; _ } ->
match ppg_cases with
| [] -> ()
| { pc_rhs; _ } :: _ ->
type_approx_aux_case_rhs env pc_rhs in_function ty_expected
type_approx_aux_cases env ppg_cases in_function ty_expected

and type_approx_aux_cases env cases in_function ty_expected =
match cases with
| [] -> ()
| { pc_rhs; _ } :: _ ->
type_approx_aux_case_rhs env pc_rhs in_function ty_expected

let type_approx env sexp ty =
type_approx_aux env sexp None ty
Expand Down

0 comments on commit e3d7c76

Please sign in to comment.