Skip to content

Minimal example now results in a StackOverflowError as of 0.6.0 #106

@ckipp01

Description

@ckipp01

In the projects that I'm using mainargs in updating to 0.6.0 results in a StackOverflowError. You can reproduce this with a minimized version of the example in the readme.

//> using scala 3.3.1
//> using dep com.lihaoyi::mainargs:0.6.0

package testhello
import mainargs.{main, arg, ParserForMethods, Flag}

object Main {
  @main
  def run(
      @arg(short = 'f')
      foo: String
  ) = {
    println(foo)
  }
  def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args)

}

This will blow up with:

Exception in thread "main" java.lang.StackOverflowError
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
        at mainargs.ParserForMethods.runEither(Parser.scala:216)
...

When you bump down to 0.5.4, everything works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions