diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-05-02 08:23:30 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-05-02 08:23:30 -0400 |
commit | a612a0c55bed76b4192fb66ffeba43933bcfb6bf (patch) | |
tree | 26303dd728d5c14aa23107593fda4ddf5e616110 /src/elab_ops.sml | |
parent | 88ea557055dc5cb1dcb15aeb65d058132ac24e22 (diff) |
In simplifying constructors for error messages, unfold constructor synonyms from modules
Diffstat (limited to 'src/elab_ops.sml')
-rw-r--r-- | src/elab_ops.sml | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/elab_ops.sml b/src/elab_ops.sml index 1546feef..6ff5e03a 100644 --- a/src/elab_ops.sml +++ b/src/elab_ops.sml @@ -336,7 +336,21 @@ fun reduceCon env (cAll as (c, loc)) = (case E.lookupCNamed env xn of (_, _, SOME c') => reduceCon env c' | _ => cAll) - | CModProj _ => cAll + | CModProj (n, ms, x) => + let + val (_, sgn) = E.lookupStrNamed env n + val (str, sgn) = foldl (fn (m, (str, sgn)) => + case E.projectStr env {sgn = sgn, str = str, field = m} of + NONE => raise Fail "reduceCon: Unknown substructure" + | SOME sgn => ((StrProj (str, m), loc), sgn)) + ((StrVar n, loc), sgn) ms + in + case E.projectCon env {sgn = sgn, str = str, field = x} of + NONE => raise Fail "reduceCon: kindof: Unknown con in structure" + | SOME (_, NONE) => cAll + | SOME (_, SOME c) => reduceCon env c + end + | CApp (c1, c2) => let val c1 = reduceCon env c1 |