comparison src/urweb.grm @ 1424:7f6ac9f33d4d

More information in error message about select of field from unbound table
author Adam Chlipala <adam@chlipala.net>
date Thu, 17 Feb 2011 14:18:18 -0500
parents 146b69c53304
children 139d019c7237
comparison
equal deleted inserted replaced
1423:bd6c90f5a428 1424:7f6ac9f33d4d
56 case (c1, c2) of 56 case (c1, c2) of
57 (CVar (ms1, x1), CVar (ms2, x2)) => ms1 = ms2 andalso x1 = x2 57 (CVar (ms1, x1), CVar (ms2, x2)) => ms1 = ms2 andalso x1 = x2
58 | (CName x1, CName x2) => x1 = x2 58 | (CName x1, CName x2) => x1 = x2
59 | _ => false 59 | _ => false
60 60
61 fun nameString (c, _) =
62 case c of
63 CName s => s
64 | CVar (_, x) => x
65 | _ => "?"
66
61 fun amend_select loc (si, (count, tabs, exps)) = 67 fun amend_select loc (si, (count, tabs, exps)) =
62 case si of 68 case si of
63 Field (tx, fx) => 69 Field (tx, fx) =>
64 let 70 let
65 val c = (CRecord ([(fx, (CWild (KType, loc), loc))]), loc) 71 val c = (CRecord ([(fx, (CWild (KType, loc), loc))]), loc)
72 false tabs 78 false tabs
73 in 79 in
74 if found then 80 if found then
75 () 81 ()
76 else 82 else
77 ErrorMsg.errorAt loc "Select of field from unbound table"; 83 ErrorMsg.errorAt loc ("Select of field " ^ nameString fx ^ " from unbound table " ^ nameString tx);
78 84
79 (count, tabs, exps) 85 (count, tabs, exps)
80 end 86 end
81 | Fields (tx, fs) => 87 | Fields (tx, fs) =>
82 let 88 let