Skip to content

Commit

Permalink
ignore coverage of unreachable error code
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek committed Sep 17, 2023
1 parent 6163c80 commit 7e35881
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/org/bykn/bosatsu/DefRecursionCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,13 @@ object DefRecursionCheck {
.flatMapN {
case (a, InRecurBranch(ir1, b1, _)) =>
setSt(InRecurBranch(ir1, b1, names)).as(a)
// $COVERAGE-OFF$ this should be unreachable
case (_, unexpected) =>
sys.error(s"invariant violation expected InRecurBranch: start = $start, end = $unexpected")
}
case notRecur =>
sys.error(s"called setNames on $notRecur with names: $newNames")
// $COVERAGE-ON$ this should be unreachable
}

private def filterNames[A](newNames: Iterable[Bindable])(in: St[A]): St[A] =
Expand All @@ -317,8 +319,10 @@ object DefRecursionCheck {
.flatMapN {
case (a, InRecurBranch(ir1, b1, _)) =>
setSt(InRecurBranch(ir1, b1, names)).as(a)
// $COVERAGE-OFF$ this should be unreachable
case (_, unexpected) =>
sys.error(s"invariant violation expected InRecurBranch: start = $start, end = $unexpected")
// $COVERAGE-ON$ this should be unreachable
}
case _ => in
}
Expand Down

0 comments on commit 7e35881

Please sign in to comment.