Skip to content

Commit 349db3d

Browse files
authored
PR#6416 et al.: injective mapping between identifiers and printed names (#1120)
1 parent c834388 commit 349db3d

34 files changed

Lines changed: 1257 additions & 198 deletions

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Working version
4848

4949
### Compiler user-interface and warnings:
5050

51+
- PR#6416, GPR#1120: unique printed names for identifiers
52+
(Florian Angeletti, review by Jacques Garrigue)
53+
5154
- MPR#7116, GPR#1430: new -config-var option
5255
to get the value of a single configuration variable in scripts.
5356
(Gabriel Scherer, review by Sébastien Hinderer and David Allsopp,

driver/compile.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ let interface ppf sourcefile outputprefix =
4444
if !Clflags.print_types then
4545
Printtyp.wrap_printing_env ~error:false initial_env (fun () ->
4646
fprintf std_formatter "%a@."
47-
Printtyp.signature (Typemod.simplify_signature sg));
47+
(Printtyp.printed_signature sourcefile)
48+
(Typemod.simplify_signature sg));
4849
ignore (Includemod.signatures initial_env sg sg);
4950
Typecore.force_delayed_checks ();
5051
Warnings.check_fatal ();

driver/optcompile.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ let interface ppf sourcefile outputprefix =
4444
if !Clflags.print_types then
4545
Printtyp.wrap_printing_env ~error:false initial_env (fun () ->
4646
fprintf std_formatter "%a@."
47-
Printtyp.signature (Typemod.simplify_signature sg));
47+
(Printtyp.printed_signature sourcefile)
48+
(Typemod.simplify_signature sg));
4849
ignore (Includemod.signatures initial_env sg sg);
4950
Typecore.force_delayed_checks ();
5051
Warnings.check_fatal ();

ocamldoc/odoc_print.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
(**************************************************************************)
1515

1616
open Format
17+
let () = Printtyp.Naming_context.enable false
1718

1819
let new_fmt () =
1920
let buf = Buffer.create 512 in

ocamldoc/odoc_str.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
(** The functions to get a string from different kinds of elements (types, modules, ...). *)
1717

1818
module Name = Odoc_name
19+
let () = Printtyp.Naming_context.enable false
1920

2021
let string_of_variance t (co,cn) =
2122
if ( t.Odoc_type.ty_kind = Odoc_type.Type_abstract ||

testsuite/tests/typing-implicit_unpack/implicit_unpack.ocaml.reference

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
val sort : (module Stdlib.Set.S with type elt = 'a) -> 'a list -> 'a list =
2-
<fun>
3-
val make_set : ('a -> 'a -> int) -> (module Stdlib.Set.S with type elt = 'a) =
4-
<fun>
1+
val sort : (module Set.S with type elt = 'a) -> 'a list -> 'a list = <fun>
2+
val make_set : ('a -> 'a -> int) -> (module Set.S with type elt = 'a) = <fun>
53
val sort_cmp : ('a -> 'a -> int) -> 'a list -> 'a list = <fun>
64
module type S = sig type t val x : t end
75
val f : (module S with type t = int) -> int = <fun>
@@ -71,8 +69,8 @@ module rec Typ :
7169
| String of ('a, string) TypEq.t
7270
| Pair of (module PAIR with type t = 'a)
7371
end
74-
val int : int Typ.typ = Int <abstr>
75-
val str : string Typ.typ = String <abstr>
72+
val int : int Typ.typ = Typ.Int <abstr>
73+
val str : string Typ.typ = Typ.String <abstr>
7674
val pair : 'a Typ.typ -> 'b Typ.typ -> ('a * 'b) Typ.typ = <fun>
7775
val to_string : 'a Typ.typ -> 'a -> string = <fun>
7876
module type MapT =

testsuite/tests/typing-misc/ocamltests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ inside_out.ml
44
labels.ml
55
occur_check.ml
66
polyvars.ml
7+
pr6416.ml
8+
pr6634.ml
79
pr6939-flat-float-array.ml
810
pr6939-no-flat-float-array.ml
911
pr7103.ml
1012
pr7228.ml
1113
pr7668_bad.ml
1214
printing.ml
1315
records.ml
16+
unique_names_in_unification.ml
1417
variant.ml
1518
wellfounded.ml
1619
empty_variant.ml

0 commit comments

Comments
 (0)