aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/elaborate.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-10-19 10:13:24 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2010-10-19 10:13:24 -0400
commit0d52aedbd9ecc04c0540ad7d7d7ff2b5051dcaa5 (patch)
tree1cded183f95d276e9d76bdcf8eb0af157eaa1763 /src/elaborate.sml
parent25838bc2eb221b82151c648473b3528e3a4e4e9d (diff)
Smarter handling of unification variables for 'kindof' on projections
Diffstat (limited to 'src/elaborate.sml')
-rw-r--r--src/elaborate.sml19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/elaborate.sml b/src/elaborate.sml
index dcae4650..3346fc37 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -583,6 +583,25 @@
| L'.CProj (c, n) =>
(case hnormKind (kindof env c) of
(L'.KTuple ks, _) => List.nth (ks, n - 1)
+ | (L'.KUnif (_, _, r), _) =>
+ let
+ val ku = kunif loc
+ val k = (L'.KTupleUnif (loc, [(n, ku)], ref NONE), loc)
+ in
+ r := SOME k;
+ k
+ end
+ | (L'.KTupleUnif (_, nks, r), _) =>
+ (case ListUtil.search (fn (n', k) => if n' = n then SOME k else NONE) nks of
+ SOME k => k
+ | NONE =>
+ let
+ val ku = kunif loc
+ val k = (L'.KTupleUnif (loc, ((n, ku) :: nks), ref NONE), loc)
+ in
+ r := SOME k;
+ k
+ end)
| k => raise CUnify' (CKindof (k, c, "tuple")))
| L'.CError => kerror