summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2019-05-02 15:25:18 +0100
committerBrian Campbell2019-05-06 16:36:45 +0100
commitf435dc901d6331514a8d64768169e7770ea8bd7a (patch)
treed78d3a39796fc4f1673e7abf84091b2304e6a63e /src
parent1d1903e5243cbad1302d00f2c102579a79d28d4d (diff)
Avoid degenerate construction monomorphisation, use # in generated names
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index a6b93d72..008d5e24 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -330,6 +330,7 @@ let split_src_type all_errors env id ty (TypQ_aux (q,ql)) =
let variants = size_nvars_ty ty in
match variants with
| [] -> None
+ | [l,_] when List.for_all (function (_,None) -> true | _ -> false) l -> None
| sample::_ ->
if List.length variants > size_set_limit then
cannot ql
@@ -342,9 +343,9 @@ let split_src_type all_errors env id ty (TypQ_aux (q,ql)) =
in
let name_seg = function
| (_,None) -> ""
- | (k,Some i) -> string_of_kid (kopt_kid k) ^ Big_int.to_string i
+ | (k,Some i) -> "#" ^ string_of_kid (kopt_kid k) ^ Big_int.to_string i
in
- let name l i = String.concat "_" (i::(List.map name_seg l)) in
+ let name l i = String.concat "" (i::(List.map name_seg l)) in
Some (List.map (fun (l,ty) -> (l, wrap (name l),ty)) variants)
let reduce_nexp subst ne =