8000 Unexpected compilation failure: "not found: value <value name>" · Issue #9171 · scala/bug · GitHub
[go: up one dir, main page]

Skip to content
Unexpected compilation failure: "not found: value <value name>" #9171
@scabug

Description

@scabug

I have encountered this problem when using scopt 3.3.0.
Here is the minimal test case that reproduces consistently.

object FailToCompileApp extends App {
  case class Options(window: Int = 30)
  val parser = new scopt.OptionParser[Options]("FailToCompileApp") {
    opt[Int]('w', "window") action { (w, options) =>
      options.copy(window = w)
    }
  }

  val options = parser.parse(args, Options()).get
  val window = options.window
}
[info] Compiling 1 Scala source to /Users/alexbool/Documents/IdeaProjects/myproject/target/scala-2.11/classes...
[error] /Users/alexbool/Documents/IdeaProjects/myproject/src/main/scala/me/alexbool/myproject/apps/FailToCompileApp.scala:7: not found: value w
[error]       options.copy(window = w)
[error]                             ^
[error] one error found
[error] (compile:compile) Compilation failed

The most exciting thing is when I remove the last line ("val window = options.window"), it compiles OK.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0