Skip to content

Commit

Permalink
Propagate tail position in Pexp_newtype
Browse files Browse the repository at this point in the history
Fixes #348.
  • Loading branch information
aantron committed Oct 31, 2020
1 parent 593a7c2 commit 6d285ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ppx/instrument.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1255,9 +1255,6 @@ class instrumenter =
in
Exp.poly ~loc ~attrs e t

| Pexp_newtype (t, e) ->
Exp.newtype ~loc ~attrs t (traverse ~is_in_tail_position:true e)

| Pexp_letop {let_; ands; body} ->
let traverse_binding_op binding_op =
{binding_op with
Expand Down Expand Up @@ -1363,6 +1360,9 @@ class instrumenter =
(self#open_declaration m)
(traverse ~is_in_tail_position e)

| Pexp_newtype (t, e) ->
Exp.newtype ~loc ~attrs t (traverse ~is_in_tail_position e)

(* Expressions that don't need instrumentation, and where AST
traversal leaves the expression language. *)
| Pexp_object c ->
Expand Down
4 changes: 2 additions & 2 deletions test/instrument/control/newtype.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Subexpression in tail position iff whole expression is in tail position.
> let _ = fun () ->
> fun (type _t) -> print_endline "foo"
> EOF
let _ = fun (type _t) -> print_endline "foo"
let _ = fun (type _t) -> ___bisect_post_visit___ 0 (print_endline "foo")
let _ =
fun () ->
___bisect_visit___ 0;
___bisect_visit___ 1;
fun (type _t) -> print_endline "foo"

0 comments on commit 6d285ea

Please sign in to comment.