From 3cd74ec699e8c7eb2089b57c0a6768717c65d285 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 10 May 2022 15:42:58 +0200 Subject: Make minor modifications --- src/Names.ml | 8 ++++++++ src/Print.ml | 8 +------- src/Substitute.ml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Names.ml b/src/Names.ml index a57f9aa1..1308eccc 100644 --- a/src/Names.ml +++ b/src/Names.ml @@ -72,3 +72,11 @@ let as_ident (pe : path_elem) : string = match pe with | Ident s -> s | Disambiguator _ -> raise (Failure "Improper variant") + +let path_elem_to_string (pe : path_elem) : string = + match pe with + | Ident s -> s + | Disambiguator d -> "{" ^ Disambiguator.to_string d ^ "}" + +let name_to_string (name : name) : string = + String.concat "::" (List.map path_elem_to_string name) diff --git a/src/Print.ml b/src/Print.ml index fedc4122..8df3001f 100644 --- a/src/Print.ml +++ b/src/Print.ml @@ -11,13 +11,7 @@ module M = Modules let option_to_string (to_string : 'a -> string) (x : 'a option) : string = match x with Some x -> "Some (" ^ to_string x ^ ")" | None -> "None" -let path_elem_to_string (pe : path_elem) : string = - match pe with - | Ident s -> s - | Disambiguator d -> "{" ^ Disambiguator.to_string d ^ "}" - -let name_to_string (name : name) : string = - String.concat "::" (List.map path_elem_to_string name) +let name_to_string (name : name) : string = Names.name_to_string name let fun_name_to_string (name : fun_name) : string = name_to_string name diff --git a/src/Substitute.ml b/src/Substitute.ml index 7cb0e8c2..c76f1da4 100644 --- a/src/Substitute.ml +++ b/src/Substitute.ml @@ -121,7 +121,7 @@ let type_decl_get_instantiated_variants_fields_rtypes (def : T.type_decl) variants | T.Struct fields -> [ (None, fields) ] | T.Opaque -> - raise (Failure "Can't retrieve the variants of an opaque type") + raise (Failure ("Can't retrieve the variants of an opaque type: " ^ Names.name_to_string def.name)) in List.map (fun (id, fields) -> -- cgit v1.2.3