Skip to content

Commit

Permalink
Require default for finite domains instead of giving up (#653)
Browse files Browse the repository at this point in the history
Should fix #652
  • Loading branch information
b-studios authored Oct 25, 2024
1 parent cd7e44f commit 70cfba8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ object ExhaustivityChecker {
cases.foreach { v =>
matches.get(v) match {
case Some(head :: tail) => matchClauses(head, tail)
case _ => E.missingLiteral(v, tpe, scrutinee)
case _ => defaults.toList match {
case Nil => E.missingLiteral(v, tpe, scrutinee)
case head :: tail => matchClauses(head, tail)
}
}
}

Expand Down
Empty file added examples/pos/issue652.check
Empty file.
4 changes: 4 additions & 0 deletions examples/pos/issue652.effek
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def foo(opt: Option[Bool]) = opt match {
case Some(false) => Some(false)
case opt => Some(true)
}
6 changes: 6 additions & 0 deletions examples/pos/issue652.effekt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def foo(opt: Option[Bool]) = opt match {
case Some(false) => Some(false)
case opt => Some(true)
}

def main() = ()

0 comments on commit 70cfba8

Please sign in to comment.