Added check that Theory.ML does not occur in the files section of the theory
authorskalberg
Wed, 31 Mar 2004 16:10:53 +0200
changeset 14503 255ad604e08e
parent 14502 0c135fa75626
child 14504 7a3d80e276d4
Added check that Theory.ML does not occur in the files section of the theory Theory.
NEWS
src/Pure/Isar/isar_thy.ML
--- a/NEWS	Wed Mar 31 11:02:00 2004 +0200
+++ b/NEWS	Wed Mar 31 16:10:53 2004 +0200
@@ -45,6 +45,11 @@
   later.  It is useful for constants whose behaviour is fixed axiomatically
   rather than definitionally, such as the meta-logic connectives.
 
+* Pure: It is now illegal to specify Theory.ML explicitly as a dependency
+  in the files section of the theory Theory. (This is more of a diagnostic
+  than a restriction, as the theory loader screws up if Theory.ML is manually
+  loaded.)
+
 *** Isar ***
 
 * Tactic emulation methods ?rule_tac, cut_tac, subgoal_tac and thin_tac:
--- a/src/Pure/Isar/isar_thy.ML	Wed Mar 31 11:02:00 2004 +0200
+++ b/src/Pure/Isar/isar_thy.ML	Wed Mar 31 16:10:53 2004 +0200
@@ -577,7 +577,11 @@
 (* theory init and exit *)
 
 fun gen_begin_theory upd name parents files =
-  ThyInfo.begin_theory Present.begin_theory upd name parents (map (apfst Path.unpack) files);
+  let val ml_filename = Path.pack (ThyLoad.ml_path name);
+      val () = if exists (equal ml_filename o #1) files
+               then error ((quote ml_filename) ^ " not allowed in files section for theory " ^ name)
+               else ()
+  in ThyInfo.begin_theory Present.begin_theory upd name parents (map (apfst Path.unpack) files) end;
 
 val begin_theory = gen_begin_theory false;