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

Rename ParseResult to ParseBlockResult to avoid shadowing a nested class of a parent class #25374

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions article/app/model/ParseBlockId.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import scala.util.parsing.combinator.RegexParsers

object ParseBlockId extends RegexParsers {

sealed trait ParseResult { def toOption: Option[String] }
case object InvalidFormat extends ParseResult { val toOption = None }
case class ParsedBlockId(blockId: String) extends ParseResult { val toOption = Some(blockId) }
sealed trait ParseBlockResult { def toOption: Option[String] }
case object InvalidFormat extends ParseBlockResult { val toOption = None }
case class ParsedBlockId(blockId: String) extends ParseBlockResult { val toOption = Some(blockId) }

private def withParser: Parser[Unit] = "with:" ^^ { _ => () }
private def block: Parser[Unit] = "block-" ^^ { _ => () }
Expand All @@ -18,7 +18,7 @@ object ParseBlockId extends RegexParsers {

// get Id from page parameter

def fromPageParam(input: String): ParseResult = {
def fromPageParam(input: String): ParseBlockResult = {
def expr: Parser[String] = withParser ~> blockId

parse(expr, input) match {
Expand All @@ -29,7 +29,7 @@ object ParseBlockId extends RegexParsers {

// get Id from block id string

def fromBlockId(input: String): ParseResult = {
def fromBlockId(input: String): ParseBlockResult = {
parse(blockId, input) match {
case Success(matched, _) => ParsedBlockId(matched)
case _ => InvalidFormat
Expand Down