summaryrefslogtreecommitdiff
path: root/src/specialize.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-04-05 17:03:33 +0100
committerAlasdair Armstrong2019-04-05 18:50:55 +0100
commit21a26461caf237783d93dacfad933fc6ef0fe0c0 (patch)
tree8d6ab8a7e39b822c92a25f27ffadc24d21506e9a /src/specialize.ml
parentfcc48f06848b9ee7e2ed22ad4a6901761db764e4 (diff)
Fix: Don't remove uncalled polymorphic constructors if they are matched upon
Previously the specialization would remove any polymorphic union constructor that was never created anywhere in the specification. While this wasn't usually problematic, it does leave an edge case where such a constructor could be matched upon in a pattern, and then the resulting match would fail to compile as it would be matching on a constructor kind that doesn't exists. This should fix that issue by chaging the V_ctor_kind value into an F_ctor_kind fragment. Previously a polymorphic constructor-kind would have been represented by its mangled name, e.g. V_ctor_kind "zSome_unit" would now be represented as V_ctor_kind ("Some", unifiers, ty) where ty is a monomorphic version of the original constructor's type such that ctyp_unify original_ty ty = unifiers and the mangled name we generate is zencode_string ("Some_" ^ string_of_list "_" string_of_ctyp unifiers)
Diffstat (limited to 'src/specialize.ml')
-rw-r--r--src/specialize.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/specialize.ml b/src/specialize.ml
index 5a7624bc..ca33ee85 100644
--- a/src/specialize.ml
+++ b/src/specialize.ml
@@ -53,7 +53,7 @@ open Ast_util
open Rewriter
let opt_ddump_spec_ast = ref None
-
+
let is_typ_ord_arg = function
| A_aux (A_typ _, _) -> true
| A_aux (A_order _, _) -> true