explicit check for correct number of arguments for abstract constructor
authorhaftmann
Sun, 03 Jun 2012 15:49:55 +0200
changeset 48068 04aeda922be2
parent 48067 9f458b3efb5c
child 48069 e9b2782c4f99
child 48070 02d64fd40852
explicit check for correct number of arguments for abstract constructor
src/Pure/Isar/code.ML
--- a/src/Pure/Isar/code.ML	Sat Jun 02 08:32:42 2012 +0200
+++ b/src/Pure/Isar/code.ML	Sun Jun 03 15:49:55 2012 +0200
@@ -637,6 +637,9 @@
       then error ("Is a class parameter: " ^ string_of_const thy c) else ()) (abs, rep);
     val _ = check_decl_ty thy (abs, raw_ty);
     val _ = check_decl_ty thy (rep, rep_ty);
+    val _ = if length (binder_types raw_ty) = 1
+      then ()
+      else bad "Bad type for abstract constructor";
     val _ = (fst o dest_Var) param
       handle TERM _ => bad "Not an abstype certificate";
     val _ = if param = rhs then () else bad "Not an abstype certificate";