tuned signature: more explicit operations;
authorwenzelm
Wed, 17 Sep 2025 11:41:27 +0200
changeset 83185 47edc6384e7a
parent 83184 9e05d3acd2b4
child 83186 887f1eac24d1
tuned signature: more explicit operations;
src/Pure/PIDE/command.scala
src/Pure/PIDE/document_status.scala
--- a/src/Pure/PIDE/command.scala	Wed Sep 17 11:30:59 2025 +0200
+++ b/src/Pure/PIDE/command.scala	Wed Sep 17 11:41:27 2025 +0200
@@ -259,8 +259,7 @@
     }
 
     private def add_status(st: Markup): State = {
-      val document_status1 =
-        document_status + Document_Status.Command_Status.make(markups = List(st))
+      val document_status1 = document_status.update(markups = List(st))
       new State(command, st :: status, results, exports, markups, document_status1)
     }
 
--- a/src/Pure/PIDE/document_status.scala	Wed Sep 17 11:30:59 2025 +0200
+++ b/src/Pure/PIDE/document_status.scala	Wed Sep 17 11:41:27 2025 +0200
@@ -41,7 +41,7 @@
       proper_elements + Markup.WARNING + Markup.LEGACY + Markup.ERROR
 
     def make(
-      markups: Iterable[Markup] = Nil,
+      markups: List[Markup] = Nil,
       warned: Boolean = false,
       failed: Boolean = false
     ): Command_Status = {
@@ -127,22 +127,28 @@
           runs = runs + that.runs)
       }
 
-    def update(warned: Boolean = false, failed: Boolean = false): Command_Status = {
-      val warned1 = this.warned || warned
-      val failed1 = this.failed || failed
-      if (this.warned == warned1 && this.failed == failed1) this
-      else {
-        new Command_Status(
-          theory_status = theory_status,
-          touched = touched,
-          accepted = accepted,
-          warned = warned1,
-          failed = failed1,
-          canceled = canceled,
-          forks = forks,
-          runs = runs
-        )
+    def update(
+      markups: List[Markup] = Nil,
+      warned: Boolean = false,
+      failed: Boolean = false
+    ): Command_Status = {
+      if (markups.isEmpty) {
+        val warned1 = this.warned || warned
+        val failed1 = this.failed || failed
+        if (this.warned == warned1 && this.failed == failed1) this
+        else {
+          new Command_Status(
+            theory_status = theory_status,
+            touched = touched,
+            accepted = accepted,
+            warned = warned1,
+            failed = failed1,
+            canceled = canceled,
+            forks = forks,
+            runs = runs)
+        }
       }
+      else this + Command_Status.make(markups = markups, warned = warned, failed = failed)
     }
 
     def maybe_consolidated: Boolean = touched && forks == 0 && runs == 0