summaryrefslogtreecommitdiff
path: root/language
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-04-05 17:03:33 +0100
committerAlasdair Armstrong2019-04-05 18:50:55 +0100
commit21a26461caf237783d93dacfad933fc6ef0fe0c0 (patch)
tree8d6ab8a7e39b822c92a25f27ffadc24d21506e9a /language
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 'language')
-rw-r--r--language/jib.ott1
1 files changed, 1 insertions, 0 deletions
diff --git a/language/jib.ott b/language/jib.ott
index 4f8eeacc..e26389ce 100644
--- a/language/jib.ott
+++ b/language/jib.ott
@@ -60,6 +60,7 @@ fragment :: 'F_' ::=
| name :: :: id
| '&' name :: :: ref
| value :: :: lit
+ | kind id ( ctyp0 , ... , ctypn ) ctyp :: :: ctor_kind
| fragment op fragment' :: :: op
| op fragment :: :: unary
| string ( fragment0 , ... , fragmentn ) :: :: call