summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-06-12 17:41:32 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-06-12 17:41:32 -0400
commit4bb0bbc1920b5474619cb00e278590e029cdb12a (patch)
tree0a6e5046476ae987bd823b4c03e666495559fbbf
parented9e3cb10161dde86a87894155f2f74c60d28c4a (diff)
Matching structures in signatures
-rw-r--r--src/elaborate.sml9
-rw-r--r--tests/modules.lac16
2 files changed, 24 insertions, 1 deletions
diff --git a/src/elaborate.sml b/src/elaborate.sml
index c61a84c1..b232a980 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -1085,7 +1085,14 @@ fun subSgn env (all1 as (sgn1, _)) (all2 as (sgn2, loc2)) =
end
| _ => NONE)
- | _ => raise Fail "Not ready for more sig matching"
+ | L'.SgiStr (x, n2, sgn2) =>
+ seek (fn sgi1All as (sgi1, _) =>
+ case sgi1 of
+ L'.SgiStr (x, n1, sgn1) =>
+ (subSgn env sgn1 sgn2;
+ SOME env)
+ | _ => NONE)
+ (* Add type equations between structures here some day. *)
end
in
ignore (foldl folder env sgis2)
diff --git a/tests/modules.lac b/tests/modules.lac
index 1bdc685c..5089f17b 100644
--- a/tests/modules.lac
+++ b/tests/modules.lac
@@ -57,3 +57,19 @@ structure Wobble2 = struct
type s = int
type t = float
end
+
+
+structure N = struct
+ type t = string
+ structure N2 = struct
+ type t = int
+ val zero = 0
+ end
+ val x = "Hi"
+end
+signature N = sig
+ structure N2 : NAT
+ type t
+ val x : t
+end
+structure No : N = N