Skip to content

Commit 6b0cdde

Browse files
committed
Fix non-exhaustiveness warnings using IllegalArgumentException
1 parent c6e764a commit 6b0cdde

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/main/scala/eu/sim642/adventofcode2019/Day13.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ object Day13 {
1616
case (acc, LazyList(x, y, tile)) =>
1717
val pos = Pos(x.toInt, y.toInt)
1818
acc + (pos -> tile.toInt)
19+
case (_, _) =>
20+
throw new IllegalArgumentException("incomplete output")
1921
})
2022
}
2123

src/main/scala/eu/sim642/adventofcode2022/Day22.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ object Day22 {
8585
case Pos(0, 1) => Pos(pos.x, mapTranspose(pos.x).indexWhere(_ != ' '))
8686
case Pos(-1, 0) => Pos(map(pos.y).lastIndexWhere(_ != ' '), pos.y)
8787
case Pos(0, -1) => Pos(pos.x, mapTranspose(pos.x).lastIndexWhere(_ != ' '))
88+
case _ => throw new IllegalArgumentException("illegal facing")
8889
}
8990
PosFacing(newPos, facing)
9091
}
@@ -120,6 +121,7 @@ object Day22 {
120121
case Pos(0, 1) => Pos(edgeLength - 1, edgeLength - 1)
121122
case Pos(-1, 0) => Pos(0, edgeLength - 1)
122123
case Pos(0, -1) => Pos(0, 0)
124+
case _ => throw new IllegalArgumentException("illegal edge")
123125
}
124126

125127
def wrap(posFacing: PosFacing): PosFacing = {

src/main/scala/eu/sim642/adventofcode2023/Day8.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ object Day8 {
1515
instructions.cycle.scanLeft(startNode)({
1616
case (node, 'L') => network(node)._1
1717
case (node, 'R') => network(node)._2
18+
case _ => throw new IllegalArgumentException("illegal instruction")
1819
})
1920
}
2021

0 commit comments

Comments
 (0)