Skip to content

Commit

Permalink
Follow up to PR #296 to use widen (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas committed Nov 12, 2021
1 parent 22b34f1 commit af1bc74
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/shared/src/main/scala/cats/parse/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1648,10 +1648,8 @@ object Parser {
// we can allocate the returned string once here
val minStr = min.toChar.toString
Impl.Map(ci, Impl.ConstFn(minStr))
case f @ (Impl.Fail() | Impl.FailWith(_)) =>
// these are really Parser[Nothing]
// but scala can't see that, so we cast
f.asInstanceOf[Parser[String]]
case f @ Impl.Fail() => f.widen
case f @ Impl.FailWith(_) => f.widen
case notStr => Impl.StringP(notStr)
}
}
Expand Down

0 comments on commit af1bc74

Please sign in to comment.