Skip to content

Commit

Permalink
Mark match that is unchecked by Scala 2 as unchecked (#3190)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown authored and kailuowang committed Dec 9, 2019
1 parent b23e647 commit f81ac6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/scala/cats/data/Chain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,10 @@ sealed abstract private[data] class ChainInstances extends ChainInstances1 {
fa.foldLeft(b)(f)
def foldRight[A, B](fa: Chain[A], lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = {
def loop(as: Chain[A]): Eval[B] =
as match {
// In Scala 2 the compiler silently ignores the fact that it can't
// prove that this match is exhaustive, but Dotty warns, so we
// explicitly mark it as unchecked.
(as: @unchecked) match {
case Chain.nil => lb
case h ==: t => f(h, Eval.defer(loop(t)))
}
Expand Down

0 comments on commit f81ac6f

Please sign in to comment.