@@ -6226,7 +6226,7 @@ and type_expect_
6226
6226
in
6227
6227
re { exp with exp_extra =
6228
6228
(Texp_poly cty, loc, sexp.pexp_attributes) :: exp.exp_extra }
6229
- | Pexp_newtype ({ txt = name } , sbody ) ->
6229
+ | Pexp_newtype (name , sbody ) ->
6230
6230
type_newtype_expr ~loc ~env ~expected_mode ~rue ~attributes: sexp.pexp_attributes
6231
6231
name None sbody
6232
6232
| Pexp_pack m ->
@@ -6664,7 +6664,7 @@ and type_function
6664
6664
(* Check everything else in the scope of (type a). *)
6665
6665
let (params, body, newtypes, contains_gadt, fun_alloc_mode, ret_info),
6666
6666
exp_type, jkind_annot =
6667
- type_newtype loc env newtype_var.txt jkind_annot (fun env ->
6667
+ type_newtype env newtype_var jkind_annot (fun env ->
6668
6668
let { function_ = exp_type, params, body;
6669
6669
newtypes; params_contain_gadt = contains_gadt;
6670
6670
fun_alloc_mode; ret_info;
@@ -8259,9 +8259,10 @@ and type_function_cases_expect
8259
8259
by the user.
8260
8260
*)
8261
8261
and type_newtype
8262
- : type a . _ -> _ -> _ -> _ -> (Env. t -> a * type_expr )
8262
+ : type a . _ -> _ -> _ -> (Env. t -> a * type_expr )
8263
8263
-> a * type_expr * Jkind. annotation option =
8264
- fun loc env name jkind_annot_opt type_body ->
8264
+ fun env name jkind_annot_opt type_body ->
8265
+ let { txt = name; loc = name_loc } : _ Location. loc = name in
8265
8266
let jkind, jkind_annot =
8266
8267
Jkind. of_annotation_option_default ~context: (Newtype_declaration name)
8267
8268
~default: (Jkind. value ~why: Univar ) jkind_annot_opt
@@ -8275,7 +8276,7 @@ and type_newtype
8275
8276
(* Use [with_local_level] just for scoping *)
8276
8277
with_local_level begin fun () ->
8277
8278
(* Create a fake abstract type declaration for name. *)
8278
- let decl = new_local_type ~loc jkind ~jkind_annot in
8279
+ let decl = new_local_type ~loc: name_loc jkind ~jkind_annot in
8279
8280
let scope = create_scope () in
8280
8281
let (id, new_env) = Env. enter_type ~scope name decl env in
8281
8282
@@ -8301,15 +8302,15 @@ and type_newtype
8301
8302
and type_newtype_expr
8302
8303
~loc ~env ~expected_mode ~rue ~attributes name jkind_annot_opt sbody =
8303
8304
let body, ety, jkind_annot =
8304
- type_newtype loc env name jkind_annot_opt (fun env ->
8305
+ type_newtype env name jkind_annot_opt (fun env ->
8305
8306
let expr = type_exp env expected_mode sbody in
8306
8307
expr, expr.exp_type)
8307
8308
in
8308
8309
(* non-expansive if the body is non-expansive, so we don't introduce
8309
8310
any new extra node in the typed AST. *)
8310
8311
rue { body with exp_loc = loc; exp_type = ety;
8311
8312
exp_extra =
8312
- (Texp_newtype (name, jkind_annot),
8313
+ (Texp_newtype (name.txt , jkind_annot),
8313
8314
loc, attributes) :: body.exp_extra }
8314
8315
8315
8316
(* Typing of let bindings *)
@@ -9191,7 +9192,7 @@ and type_jkind_expr
9191
9192
~loc ~env ~expected_mode ~ty_expected :_ ~explanation :_ ~rue ~attributes
9192
9193
: Jane_syntax.Layouts.expression -> _ = function
9193
9194
| Lexp_constant x -> type_unboxed_constant ~loc ~env ~rue ~attributes x
9194
- | Lexp_newtype ({ txt = name } , jkind_annot , sbody ) ->
9195
+ | Lexp_newtype (name , jkind_annot , sbody ) ->
9195
9196
type_newtype_expr ~loc ~env ~expected_mode ~rue ~attributes
9196
9197
name (Some jkind_annot) sbody
9197
9198
0 commit comments