# HG changeset patch
# User Adam Chlipala <adam@chlipala.net>
# Date 1335031030 14400
# Node ID 16ee7ff7f1198b76e5b46c3b558f8d0aae7fb46d
# Parent  05ae68e019b6605c47ead030a8193e7effc1b4c2
Avoid kindof failures in elaboration

diff -r 05ae68e019b6 -r 16ee7ff7f119 src/elaborate.sml
--- a/src/elaborate.sml	Mon Apr 16 10:12:04 2012 -0400
+++ b/src/elaborate.sml	Sat Apr 21 13:57:10 2012 -0400
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008-2011, Adam Chlipala
+(* Copyright (c) 2008-2012, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -393,11 +393,10 @@
                                         | SOME sgn => ((L'.StrProj (str, m), loc), sgn))
                                    ((L'.StrVar n, loc), sgn) ms
 
-                  val k = case E.projectCon env {sgn = sgn, str = str, field = s} of
-                              NONE => (conError env (UnboundCon (loc, s));
-                                       kerror)
-                            | SOME (k, _) => k
-                 val (c, k) = elabConHead env (L'.CModProj (n, ms, s), loc) k
+                  val (c, k) = case E.projectCon env {sgn = sgn, str = str, field = s} of
+                                   NONE => (conError env (UnboundCon (loc, s));
+                                            (cerror, kerror))
+                                 | SOME (k, _) => elabConHead env (L'.CModProj (n, ms, s), loc) k
               in
                   (c, k, [])
               end)
diff -r 05ae68e019b6 -r 16ee7ff7f119 tests/unbound.ur
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/unbound.ur	Sat Apr 21 13:57:10 2012 -0400
@@ -0,0 +1,3 @@
+structure M = struct end
+
+fun f (x : $M.r) : $([A = int] ++ M.r) = x