ocaml-flambda / flambda-backend

The Flambda backend project for OCaml
94 stars 70 forks source link

Change [%call_pos] to the function's start position, not the application's #2765

Closed Enoumy closed 2 weeks ago

Enoumy commented 2 weeks ago

This feature adjusts the position that [%call_pos] uses. The motivation is |>:

(* f : here:[%call_pos] -> unit -> unit *)
() |> f |> f

Previously, both calls to f received the same position for ~here! Both positions were the start of ().

This is because the AST of the expression is roughly ((() |> f) |> f) and since call_pos uses the location of the entire function application, both calls to f had the same starting location (despite having different ending locations.)

This is change in this commit by making [%call_pos] use the start position of the function instead of the start position of the entire application.