comparison src/elaborate.sml @ 1657:2b7d3d99dc42

Prevent unifications of 'others' pieces in record summaries, when both pieces contain unification variables (to prevent undesired unifications)
author Adam Chlipala <adam@chlipala.net>
date Thu, 05 Jan 2012 17:10:43 -0500
parents dc986eb6113c
children de0a34e28bfa
comparison
equal deleted inserted replaced
1656:3e7c7e200713 1657:2b7d3d99dc42
863 (*val () = eprefaces "Summaries2" [("#1", p_summary env {fields = fs1, unifs = #unifs s1, others = #others s1}), 863 (*val () = eprefaces "Summaries2" [("#1", p_summary env {fields = fs1, unifs = #unifs s1, others = #others s1}),
864 ("#2", p_summary env {fields = fs2, unifs = #unifs s2, others = #others s2})]*) 864 ("#2", p_summary env {fields = fs2, unifs = #unifs s2, others = #others s2})]*)
865 865
866 val (unifs1, unifs2) = eatMatching (fn ((_, r1), (_, r2)) => r1 = r2) (#unifs s1, #unifs s2) 866 val (unifs1, unifs2) = eatMatching (fn ((_, r1), (_, r2)) => r1 = r2) (#unifs s1, #unifs s2)
867 867
868 val (others1, others2) = eatMatching (consEq env loc) (#others s1, #others s2) 868 val hasUnifs = U.Con.exists {kind = fn _ => false,
869 con = fn L'.CUnif _ => true
870 | _ => false}
871
872 val (others1, others2) = eatMatching (fn (c1, c2) =>
873 not (hasUnifs c1 andalso hasUnifs c2)
874 andalso consEq env loc (c1, c2)) (#others s1, #others s2)
869 (*val () = eprefaces "Summaries3" [("#1", p_summary env {fields = fs1, unifs = unifs1, others = others1}), 875 (*val () = eprefaces "Summaries3" [("#1", p_summary env {fields = fs1, unifs = unifs1, others = others1}),
870 ("#2", p_summary env {fields = fs2, unifs = unifs2, others = others2})]*) 876 ("#2", p_summary env {fields = fs2, unifs = unifs2, others = others2})]*)
871 877
872 fun unsummarize {fields, unifs, others} = 878 fun unsummarize {fields, unifs, others} =
873 let 879 let