Skip to content

Commit 9706da8

Browse files
committed
use Location.print_loc
1 parent 6a76c51 commit 9706da8

5 files changed

+15
-12
lines changed

jscomp/build_tests/super_errors/expected/repeated_def_extension_constr.res.expected

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
3 │ type a
88
4 │
99

10-
Multiple definition of the type name a at line 1, characters 5-6.
11-
Names must be unique in a given structure or signature.
10+
Multiple definition of the type name a
11+
at /.../fixtures/repeated_def_extension_constr.res:1:6
12+
Names must be unique in a given structure or signature.

jscomp/build_tests/super_errors/expected/repeated_def_module_types.res.expected

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
3 │ module type M = {}
88
4 │
99

10-
Multiple definition of the module type name M at line 1, characters 12-13.
11-
Names must be unique in a given structure or signature.
10+
Multiple definition of the module type name M
11+
at /.../fixtures/repeated_def_module_types.res:1:13
12+
Names must be unique in a given structure or signature.

jscomp/build_tests/super_errors/expected/repeated_def_modules.res.expected

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
3 │ module M = {}
88
4 │
99

10-
Multiple definition of the module name M at line 1, characters 7-8.
11-
Names must be unique in a given structure or signature.
10+
Multiple definition of the module name M
11+
at /.../fixtures/repeated_def_modules.res:1:8
12+
Names must be unique in a given structure or signature.

jscomp/build_tests/super_errors/expected/repeated_def_types.res.expected

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
3 │ type a
88
4 │
99

10-
Multiple definition of the type name a at line 1, characters 5-6.
11-
Names must be unique in a given structure or signature.
10+
Multiple definition of the type name a
11+
at /.../fixtures/repeated_def_types.res:1:6
12+
Names must be unique in a given structure or signature.

jscomp/ml/typemod.ml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1862,11 +1862,10 @@ let report_error ppf = function
18621862
types (other than when replacing a type constructor with @ \
18631863
a type constructor with the same arguments).@]"
18641864
| Repeated_name(kind, name, repeated_loc) ->
1865-
let (_, start_line, start_char) = Location.get_pos_info repeated_loc.loc_start in
1866-
let (_, _, end_char) = Location.get_pos_info repeated_loc.loc_end in
18671865
fprintf ppf
1868-
"@[Multiple definition of the %s name %s at line %d, characters %d-%d.@ \
1869-
Names must be unique in a given structure or signature.@]" kind name start_line start_char end_char
1866+
"@[Multiple definition of the %s name %s @ \
1867+
at @{<loc>%a@}@ @ \
1868+
Names must be unique in a given structure or signature.@]" kind name Location.print_loc repeated_loc
18701869
| Non_generalizable typ ->
18711870
(* modified *)
18721871
fprintf ppf "@[<v>";

0 commit comments

Comments
 (0)