Order of implicit parameters in locale expression.
authorballarin
Tue, 09 Dec 2008 15:34:49 +0100
changeset 29030 0ea94f540548
parent 29029 1945e0185097
child 29031 e74341997a48
Order of implicit parameters in locale expression.
src/Pure/Isar/expression.ML
--- a/src/Pure/Isar/expression.ML	Tue Dec 09 13:11:42 2008 +0100
+++ b/src/Pure/Isar/expression.ML	Tue Dec 09 15:34:49 2008 +0100
@@ -135,6 +135,13 @@
       end;
 
     fun match_bind (n, b) = (n = Binding.base_name b);
+    fun parm_eq ((b1, mx1), (b2, mx2)) =
+      (* FIXME: cannot compare bindings for equality, instead check for equal name and syntax *)
+      (Binding.base_name b1 = Binding.base_name b2) andalso
+      (if mx1 = mx2 then true
+      else error ("Conflicting syntax for parameter" ^ quote (Binding.display b1) ^
+                    " in expression."));
+      
     fun bind_eq (b1, b2) = (Binding.base_name b1 = Binding.base_name b2);
       (* FIXME: cannot compare bindings for equality. *)
 
@@ -166,12 +173,7 @@
             val (is', ps') = fold_map (fn i => fn ps =>
               let
                 val (ps', i') = params_inst i;
-                val ps'' = AList.join bind_eq (fn p => fn (mx1, mx2) =>
-                  (* FIXME: should check for bindings being the same.
-                     Instead we check for equal name and syntax. *)
-                  if mx1 = mx2 then mx1
-                  else error ("Conflicting syntax for parameter" ^ quote (Binding.display p) ^
-                    " in expression.")) (ps, ps')
+                val ps'' = distinct parm_eq (ps @ ps');
               in (i', ps'') end) is []
           in (ps', is') end;