Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with "|" in the documentation #1093

Open
TheDeadOne opened this issue Jul 5, 2022 · 4 comments · May be fixed by #1092
Open

Error with "|" in the documentation #1093

TheDeadOne opened this issue Jul 5, 2022 · 4 comments · May be fixed by #1092
Labels

Comments

@TheDeadOne
Copy link

TheDeadOne commented Jul 5, 2022

steps

  1. Open https://www.scala-sbt.org/1.x/docs/Parsing-Input.html#Combining+parsers
  2. Copy-paste line val color: Parser[String] = "blue" | "green" in sbt console or in build.sbt

problem

error: value | is not a member of String

expectation

A parser that succeeds if the input is "blue" or "green" as wrote in the documentation.

notes

sbt 1.2.8, 1.6.2
scala 2.12.10

@TheDeadOne TheDeadOne added the bug label Jul 5, 2022
@eed3si9n
Copy link
Member

eed3si9n commented Jul 5, 2022

The doc says

The following examples assume the imports:

import sbt._
import complete.DefaultParsers._

@TheDeadOne
Copy link
Author

The doc says

The following examples assume the imports:

import sbt._
import complete.DefaultParsers._

Of course I imported them. Otherwise the error would be different.

@SethTisue
Copy link
Member

SethTisue commented Jul 7, 2022

I'm able to reproduce the problem (value | is not a member of String) with the following build.sbt:

import complete.DefaultParsers._
import complete.Parser
val color: Parser[String] = "blue" | "green"

note that I had to add import complete.Parser

(.sbt files don't need explicit import sbt._, I don't think)

I poked around further trying to find a fix but but failed 🤷

@TheDeadOne
Copy link
Author

@xuwei-k xuwei-k transferred this issue from sbt/sbt Jul 8, 2022
@xuwei-k xuwei-k linked a pull request Jul 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants