summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2019-09-20 13:39:07 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2019-09-20 13:39:07 -0400
commitabf8a0434cb1c1ab22a50182ffdc6cf0c4645523 (patch)
tree4c2cf290654b5b11523bc25156ecfac5ca17f0f1
parent3f8929c83b451837fcd9dc9475534c0e78967ab2 (diff)
Laxer wildcard restriction for signatures
-rw-r--r--src/elaborate.sml18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/elaborate.sml b/src/elaborate.sml
index c6825150..fbbde303 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -264,14 +264,16 @@
* We use a flag to indicate when we are in a signature,
* with a helper function for entering this mode and properly backing out afterward. *)
val inSignature = ref false
- fun enterSignature f =
+ fun enterSignature' b f =
let
val inS = !inSignature
in
- inSignature := true;
+ inSignature := b;
(f () handle ex => (inSignature := inS; raise ex))
before inSignature := inS
end
+ fun enterSignature f = enterSignature' true f
+ fun exitSignature f = enterSignature' false f
fun elabKind env (k, loc) =
case k of
@@ -2577,14 +2579,10 @@ fun elabSgn_item ((sgi, loc), (env, denv, gs)) =
let
val k' = case ko of
NONE => kunif env loc
- | SOME k =>
- case #1 k of
- L.KWild => kunif env loc
- (* Why duplicate this case of elabKind here?
- * To avoid flagging a disallowed wildcard in
- * a signature, since we are guaranteed to
- * resolve this kind locally during elaboration. *)
- | _ => elabKind env k
+ | SOME k => exitSignature (fn () => elabKind env k)
+ (* Waive wildcard restriction within translation
+ * of kind annotation. The kind of [c] will allow
+ * us to resolve it fully. *)
val (c', ck, gs') = elabCon (env, denv) c
val (env', n) = E.pushCNamed env x k' (SOME c')