more careful treatment of context for method source;
authorwenzelm
Fri, 19 May 2023 22:09:06 +0200
changeset 78080 b0bcba8afdd8
parent 78079 270e85124a9a
child 78081 40db83793cea
more careful treatment of context for method source;
src/Pure/Isar/method.ML
--- a/src/Pure/Isar/method.ML	Fri May 19 21:48:11 2023 +0200
+++ b/src/Pure/Isar/method.ML	Fri May 19 22:09:06 2023 +0200
@@ -607,12 +607,17 @@
                   map (fn (a, bs) => (Proof_Context.get_fact ctxt a, map prep_att bs)) xthms;
                 val facts =
                   Attrib.partial_evaluation ctxt [((Binding.name "dummy", []), thms)]
-                  |> map (fn (_, bs) => ((Binding.empty, [Attrib.internal (K attribute)]), bs));
+                  |> map (fn (_, bs) =>
+                    ((Binding.empty, [Attrib.internal (K attribute)]), Attrib.trim_context_thms bs));
 
                 val decl =
-                  Morphism.entity (fn phi =>
-                    Context.mapping I init #>
-                    Attrib.generic_notes "" (Attrib.transform_facts phi facts) #> snd);
+                  Morphism.entity (fn phi => fn context =>
+                    let val psi = Morphism.set_context'' context phi in
+                      context
+                      |> Context.mapping I init
+                      |> Attrib.generic_notes "" (Attrib.transform_facts psi facts)
+                      |> snd
+                    end);
 
                 val modifier_report =
                   (#1 (Token.range_of modifier_toks),