src/Pure/System/getopts.scala
changeset 71601 97ccf48c2f0c
parent 71383 8313dca6dee9
child 73359 d8a0e996614b
--- a/src/Pure/System/getopts.scala	Fri Mar 27 13:04:15 2020 +0100
+++ b/src/Pure/System/getopts.scala	Fri Mar 27 22:01:27 2020 +0100
@@ -7,6 +7,9 @@
 package isabelle
 
 
+import scala.annotation.tailrec
+
+
 object Getopts
 {
   def apply(usage_text: String, option_specs: (String, String => Unit)*): Getopts =
@@ -44,7 +47,7 @@
         cat_error(msg, "The error(s) above occurred in command-line option " + print_option(opt))
     }
 
-  private def getopts(args: List[List[Char]]): List[List[Char]] =
+  @tailrec private def getopts(args: List[List[Char]]): List[List[Char]] =
     args match {
       case List('-', '-') :: rest_args => rest_args
       case ('-' :: opt :: rest_opts) :: rest_args if is_option0(opt) && rest_opts.nonEmpty =>