named target is optional
authorhaftmann
Thu, 12 Aug 2010 13:42:12 +0200
changeset 38390 cb72d89bb444
parent 38389 d7d915bae307
child 38391 ba1cc1815ce1
named target is optional
src/Pure/Isar/class_declaration.ML
src/Tools/quickcheck.ML
--- a/src/Pure/Isar/class_declaration.ML	Thu Aug 12 13:28:18 2010 +0200
+++ b/src/Pure/Isar/class_declaration.ML	Thu Aug 12 13:42:12 2010 +0200
@@ -311,8 +311,8 @@
     val thy = ProofContext.theory_of lthy;
     val proto_sup = prep_class thy raw_sup;
     val proto_sub = case Named_Target.peek lthy
-     of {is_class = false, ...} => error "Not in a class context"
-      | {target, ...} => target;
+     of SOME {target, is_class = true, ...} => target
+      | _ => error "Not in a class target";
     val (sub, sup) = AxClass.cert_classrel thy (proto_sub, proto_sup);
 
     val expr = ([(sup, (("", false), Expression.Positional []))], []);
--- a/src/Tools/quickcheck.ML	Thu Aug 12 13:28:18 2010 +0200
+++ b/src/Tools/quickcheck.ML	Thu Aug 12 13:42:12 2010 +0200
@@ -219,9 +219,10 @@
       | strip t = t;
     val {goal = st, ...} = Proof.raw_goal state;
     val (gi, frees) = Logic.goal_params (prop_of st) i;
-    val some_locale = case (#target o Named_Target.peek) lthy
-     of "" => NONE
-      | locale => SOME locale;
+    val some_locale = case (Option.map #target o Named_Target.peek) lthy
+     of NONE => NONE
+      | SOME "" => NONE
+      | SOME locale => SOME locale;
     val assms = if no_assms then [] else case some_locale
      of NONE => Assumption.all_assms_of lthy
       | SOME locale => Assumption.local_assms_of lthy (Locale.init locale thy);