diff options
author | Son Ho | 2022-05-10 15:42:58 +0200 |
---|---|---|
committer | Son Ho | 2022-05-10 15:42:58 +0200 |
commit | 3cd74ec699e8c7eb2089b57c0a6768717c65d285 (patch) | |
tree | 9af456bee041f5363471f0193733ac6dac4bdedf /src | |
parent | 5587701ef0015563b175c1a06517fca822e310c4 (diff) |
Make minor modifications
Diffstat (limited to '')
-rw-r--r-- | src/Names.ml | 8 | ||||
-rw-r--r-- | src/Print.ml | 8 | ||||
-rw-r--r-- | src/Substitute.ml | 2 |
3 files changed, 10 insertions, 8 deletions
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) -> |