Skip to content

Commit 777719d

Browse files
Gustavo2622strub
authored andcommitted
PR: Fix printing of idents and rename EcIdent.tostring to tostring_internal for clarity of use
1 parent 670632d commit 777719d

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/ecEnv.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ let pp_lookup_failure fmt e =
346346
| `MPath p -> EcPath.m_tostring p
347347
| `Path p -> EcPath.tostring p
348348
| `QSymbol p -> string_of_qsymbol p
349-
| `AbsStmt p -> EcIdent.tostring p
349+
| `AbsStmt p -> EcIdent.name p
350350
in
351351
Format.fprintf fmt "unknown symbol: %s" p
352352

@@ -3328,11 +3328,11 @@ module LDecl = struct
33283328
33293329
| LookupError (`Ident id) ->
33303330
Format.fprintf fmt "unknown identifier `%s`, please report"
3331-
(EcIdent.tostring id)
3331+
(EcIdent.tostring_internal id)
33323332
33333333
| NameClash (`Ident id) ->
33343334
Format.fprintf fmt "name clash for `%s`, please report"
3335-
(EcIdent.tostring id)
3335+
(EcIdent.tostring_internal id)
33363336
33373337
let _ = EcPException.register (fun fmt exn ->
33383338
match exn with

src/ecFol.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,14 +1113,14 @@ let rec dump_f f =
11131113
in
11141114

11151115
match f.f_node with
1116-
| Fquant (q, bs, f) -> dump_quant q ^ " ( " ^ String.concat ", " (List.map EcIdent.tostring (List.fst bs)) ^ " )" ^ "." ^ dump_f f (* of quantif * bindings * form *)
1116+
| Fquant (q, bs, f) -> dump_quant q ^ " ( " ^ String.concat ", " (List.map EcIdent.tostring_internal (List.fst bs)) ^ " )" ^ "." ^ dump_f f (* of quantif * bindings * form *)
11171117
| Fif (c, t, f) -> "IF " ^ dump_f c ^ " THEN " ^ dump_f t ^ " ELSE " ^ dump_f f
11181118
| Fmatch _ -> "MATCH"
11191119
| Flet (_, f, g) -> "LET _ = " ^ dump_f f ^ " IN " ^ dump_f g
11201120
| Fint x -> BI.to_string x
1121-
| Flocal x -> EcIdent.tostring x
1122-
| Fpvar (pv, x) -> EcTypes.string_of_pvar pv ^ "{" ^ EcIdent.tostring x ^ "}"
1123-
| Fglob (mp, x) -> EcIdent.tostring mp ^ "{" ^ EcIdent.tostring x ^ "}"
1121+
| Flocal x -> EcIdent.tostring_internal x
1122+
| Fpvar (pv, x) -> EcTypes.string_of_pvar pv ^ "{" ^ EcIdent.tostring_internal x ^ "}"
1123+
| Fglob (mp, x) -> EcIdent.tostring_internal mp ^ "{" ^ EcIdent.tostring_internal x ^ "}"
11241124
| Fop (p, _) -> EcPath.tostring p
11251125
| Fapp (f, a) -> "APP " ^ dump_f f ^ " ( " ^ String.concat ", " (List.map dump_f a) ^ " )"
11261126
| Ftuple f -> " ( " ^ String.concat ", " (List.map dump_f f) ^ " )"
@@ -1130,16 +1130,16 @@ let rec dump_f f =
11301130
| FhoareS _ -> "HoareS"
11311131
| FbdHoareF _ -> "bdHoareF"
11321132
| FbdHoareS ({bhs_m = (m, _)} as hs) ->
1133-
"bdHoareS [ ME = " ^ EcIdent.tostring m
1133+
"bdHoareS [ ME = " ^ EcIdent.tostring_internal m
11341134
^ "; PR = " ^ dump_f (bhs_pr hs).inv
11351135
^ "; PO = " ^ dump_f (bhs_po hs).inv
11361136
^ "; BD = " ^ dump_f (bhs_bd hs).inv ^ "]"
11371137
| FeHoareS _ -> "eHoareS"
11381138
| FeHoareF _ -> "eHoareF"
11391139
| FequivF _ -> "equivF"
11401140
| FequivS ({es_ml = (ml, _); es_mr = (mr, _)} as es) ->
1141-
"equivS [ ML = " ^ EcIdent.tostring ml
1142-
^ "; MR = " ^ EcIdent.tostring mr
1141+
"equivS [ ML = " ^ EcIdent.tostring_internal ml
1142+
^ "; MR = " ^ EcIdent.tostring_internal mr
11431143
^ "; PR = " ^ dump_f (es_pr es).inv
11441144
^ "; PO = " ^ dump_f (es_po es).inv
11451145
^ "]"

src/ecIdent.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ let create (x : symbol) =
5252

5353
let fresh (id : t) = create (name id)
5454

55-
let tostring (id : t) =
55+
let tostring_internal (id : t) =
5656
Printf.sprintf "%s/%d" id.id_symb id.id_tag
5757

5858
(* -------------------------------------------------------------------- *)

src/ecIdent.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ val create : symbol -> t
1616
val fresh : t -> t
1717
val name : t -> symbol
1818
val tag : t -> int
19-
val tostring : t -> string
19+
val tostring_internal : t -> string
2020

2121
(* -------------------------------------------------------------------- *)
2222
val id_equal : t -> t -> bool

src/ecPath.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ let rec pp_m fmt mp =
306306
Format.fprintf fmt "@[(%a)@]" (pp_list "," pp_m) args in
307307
match mp.m_top with
308308
| `Local id ->
309-
Format.fprintf fmt "%s%a" (EcIdent.tostring id) pp_args mp.m_args
309+
Format.fprintf fmt "%s%a" (EcIdent.name id) pp_args mp.m_args
310310
| `Concrete(p,None) ->
311311
Format.fprintf fmt "%s%a" (tostring p) pp_args mp.m_args
312312
| `Concrete(p,Some sub) ->
@@ -375,7 +375,7 @@ end
375375
let rec m_tostring (m : mpath) =
376376
let top, sub =
377377
match m.m_top with
378-
| `Local id -> (EcIdent.tostring id, "")
378+
| `Local id -> (EcIdent.name id, "")
379379

380380
| `Concrete (p, sub) ->
381381
let strsub =

src/ecPrinting.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ module PPEnv = struct
276276
let name = EcIdent.name x in
277277
match EcEnv.Mod.sp_lookup_opt ([], name) ppe.ppe_env with
278278
| Some (p, _, _) when EcPath.mt_equal mp.P.m_top p.P.m_top -> name
279-
| _ -> EcIdent.tostring x
279+
| _ -> EcIdent.name x
280280
in
281281
([], name, None)
282282

@@ -354,7 +354,7 @@ module PPEnv = struct
354354

355355
let tyvar (ppe : t) x =
356356
match Mid.find_opt x ppe.ppe_locals with
357-
| None -> EcIdent.tostring x
357+
| None -> EcIdent.name x
358358
| Some x -> x
359359

360360
exception FoundUnivarSym of symbol
@@ -620,7 +620,7 @@ let pp_modtype1 (ppe : PPEnv.t) fmt mty =
620620

621621
(* -------------------------------------------------------------------- *)
622622
let pp_local (ppe : PPEnv.t) fmt x =
623-
Format.fprintf fmt "%s" (EcIdent.tostring x)
623+
Format.fprintf fmt "%s" (EcIdent.name x)
624624

625625
(* -------------------------------------------------------------------- *)
626626
let pp_local ?fv (ppe : PPEnv.t) fmt x =
@@ -836,7 +836,7 @@ let pp_mem (ppe : PPEnv.t) (fmt : Format.formatter) (x as id : memory) =
836836
else x
837837
in
838838
if debug_mode then
839-
Format.fprintf fmt "%s<%s>" x (EcIdent.tostring id)
839+
Format.fprintf fmt "%s<%s>" x (EcIdent.tostring_internal id)
840840
else
841841
Format.fprintf fmt "%s" x
842842

src/ecTypes.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ module Hty = MSHty.H
3939
let rec dump_ty ty =
4040
match ty.ty_node with
4141
| Tglob p ->
42-
EcIdent.tostring p
42+
EcIdent.tostring_internal p
4343

4444
| Tunivar i ->
4545
Printf.sprintf "#%d" i
4646

4747
| Tvar id ->
48-
EcIdent.tostring id
48+
EcIdent.tostring_internal id
4949

5050
| Ttuple tys ->
5151
Printf.sprintf "(%s)" (String.concat ", " (List.map dump_ty tys))

0 commit comments

Comments
 (0)