Commit 6018a66f authored by Kim Nguyễn's avatar Kim Nguyễn

Change the ordering use for types during constraint generation with one which...

Change the ordering use for types during constraint generation with one which is compatible with subtyping, when types are comparable.
parent 865e16c6
...@@ -15,13 +15,14 @@ exception UnSatConstr of string ...@@ -15,13 +15,14 @@ exception UnSatConstr of string
module CS = struct module CS = struct
(* we require that types are semantically equivalent and not structurally
* equivalent *)
let semantic_compare t1 t2 = let semantic_compare t1 t2 =
let c = Types.compare t1 t2 in let inf12 = Types.subtype t1 t2 in
if c = 0 then 0 else let inf21 = Types.subtype t2 t1 in
if equiv t1 t2 then 0 if inf12 && inf21 then 0
else c else if inf12 then -1 else if inf21 then 1 else
let c = Types.compare t1 t2 in
assert (c <> 0);
c
(* constraint set : map to store constraints of the form (s <= alpha <= t) *) (* constraint set : map to store constraints of the form (s <= alpha <= t) *)
module M = struct module M = struct
...@@ -753,7 +754,7 @@ let apply_raw delta s t = ...@@ -753,7 +754,7 @@ let apply_raw delta s t =
NormMemoHash.clear memo_norm; NormMemoHash.clear memo_norm;
let s = Substitution.kind delta Var.function_kind s in let s = Substitution.kind delta Var.function_kind s in
let t = Substitution.kind delta Var.argument_kind t in let t = Substitution.kind delta Var.argument_kind t in
let vgamma = Var.mk "Gamma" in let vgamma = Var.mk "Gamma" in
let gamma = var vgamma in let gamma = var vgamma in
let cgamma = cons gamma in let cgamma = cons gamma in
......
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