@@ -6200,7 +6200,7 @@ and type_expect_
6200
6200
in
6201
6201
re { exp with exp_extra =
6202
6202
(Texp_poly cty, loc, sexp.pexp_attributes) :: exp.exp_extra }
6203
- | Pexp_newtype ({ txt = name } , sbody ) ->
6203
+ | Pexp_newtype (name , sbody ) ->
6204
6204
type_newtype_expr ~loc ~env ~expected_mode ~rue ~attributes: sexp.pexp_attributes
6205
6205
name None sbody
6206
6206
| Pexp_pack m ->
@@ -6638,7 +6638,7 @@ and type_function
6638
6638
(* Check everything else in the scope of (type a). *)
6639
6639
let (params, body, newtypes, contains_gadt, fun_alloc_mode, ret_info),
6640
6640
exp_type, jkind_annot =
6641
- type_newtype loc env newtype_var.txt jkind_annot (fun env ->
6641
+ type_newtype env newtype_var jkind_annot (fun env ->
6642
6642
let { function_ = exp_type, params, body;
6643
6643
newtypes; params_contain_gadt = contains_gadt;
6644
6644
fun_alloc_mode; ret_info;
@@ -8233,9 +8233,10 @@ and type_function_cases_expect
8233
8233
by the user.
8234
8234
*)
8235
8235
and type_newtype
8236
- : type a . _ -> _ -> _ -> _ -> (Env. t -> a * type_expr )
8236
+ : type a . _ -> _ -> _ -> (Env. t -> a * type_expr )
8237
8237
-> a * type_expr * Jkind. annotation option =
8238
- fun loc env name jkind_annot_opt type_body ->
8238
+ fun env name jkind_annot_opt type_body ->
8239
+ let { txt = name; loc = name_loc } : _ Location. loc = name in
8239
8240
let jkind, jkind_annot =
8240
8241
Jkind. of_annotation_option_default ~context: (Newtype_declaration name)
8241
8242
~default: (Jkind. value ~why: Univar ) jkind_annot_opt
@@ -8249,7 +8250,7 @@ and type_newtype
8249
8250
(* Use [with_local_level] just for scoping *)
8250
8251
with_local_level begin fun () ->
8251
8252
(* Create a fake abstract type declaration for name. *)
8252
- let decl = new_local_type ~loc jkind ~jkind_annot in
8253
+ let decl = new_local_type ~loc: name_loc jkind ~jkind_annot in
8253
8254
let scope = create_scope () in
8254
8255
let (id, new_env) = Env. enter_type ~scope name decl env in
8255
8256
@@ -8275,15 +8276,15 @@ and type_newtype
8275
8276
and type_newtype_expr
8276
8277
~loc ~env ~expected_mode ~rue ~attributes name jkind_annot_opt sbody =
8277
8278
let body, ety, jkind_annot =
8278
- type_newtype loc env name jkind_annot_opt (fun env ->
8279
+ type_newtype env name jkind_annot_opt (fun env ->
8279
8280
let expr = type_exp env expected_mode sbody in
8280
8281
expr, expr.exp_type)
8281
8282
in
8282
8283
(* non-expansive if the body is non-expansive, so we don't introduce
8283
8284
any new extra node in the typed AST. *)
8284
8285
rue { body with exp_loc = loc; exp_type = ety;
8285
8286
exp_extra =
8286
- (Texp_newtype (name, jkind_annot),
8287
+ (Texp_newtype (name.txt , jkind_annot),
8287
8288
loc, attributes) :: body.exp_extra }
8288
8289
8289
8290
(* Typing of let bindings *)
@@ -9166,7 +9167,7 @@ and type_jkind_expr
9166
9167
~loc ~env ~expected_mode ~ty_expected :_ ~explanation :_ ~rue ~attributes
9167
9168
: Jane_syntax.Layouts.expression -> _ = function
9168
9169
| Lexp_constant x -> type_unboxed_constant ~loc ~env ~rue ~attributes x
9169
- | Lexp_newtype ({ txt = name } , jkind_annot , sbody ) ->
9170
+ | Lexp_newtype (name , jkind_annot , sbody ) ->
9170
9171
type_newtype_expr ~loc ~env ~expected_mode ~rue ~attributes
9171
9172
name (Some jkind_annot) sbody
9172
9173
0 commit comments