Commit f73e98bb authored by Pietro Abate's avatar Pietro Abate
Browse files

Fix bug #34 Ban polymorphic references

parent e61f8fd5
Subproject commit 35b008173b9a6af2ca3de5dacbc44367dbe6defc
Subproject commit f12f696955d17ef8a9074f1dc7fe7be24d6c95e5
......@@ -1111,8 +1111,17 @@ and type_check' loc env ed constr precise = match ed with
(ed,verify loc t constr)
| Ref (e,t) ->
ignore (type_check env e (Types.descr t) false);
(ed,verify loc (Builtin_defs.ref_type t) constr)
let td = Types.descr t in
let vars = Types.all_vars td in
if not(Var.Set.subset vars then
error loc (
"Type ref %s constains polymorphic variables"
(Types.Print.string_of_type td))
else begin
ignore (type_check env e td false);
(ed,verify loc (Builtin_defs.ref_type t) constr)
| External (t,_) ->
(ed,verify loc t constr)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment