aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/compiler/default/phase/analysis/case.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis/case.lux24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/compiler/default/phase/analysis/case.lux b/stdlib/source/lux/compiler/default/phase/analysis/case.lux
index 0d3536db3..2081ceb61 100644
--- a/stdlib/source/lux/compiler/default/phase/analysis/case.lux
+++ b/stdlib/source/lux/compiler/default/phase/analysis/case.lux
@@ -22,7 +22,7 @@
["/." //
["." extension]]]
[/
- ["." coverage]])
+ ["." coverage (#+ Coverage)]])
(exception: #export (cannot-match-with-pattern {type Type} {pattern Code})
(ex.report ["Type" (%type type)]
@@ -32,19 +32,19 @@
(ex.report ["Case" (%n case)]
["Type" (%type type)]))
-(exception: #export (unrecognized-pattern-syntax {pattern Code})
- (%code pattern))
+(exception: #export (not-a-pattern {code Code})
+ (ex.report ["Code" (%code code)]))
(exception: #export (cannot-simplify-for-pattern-matching {type Type})
- (%type type))
+ (ex.report ["Type" (%type type)]))
-(do-template [<name>]
- [(exception: #export (<name> {message Text})
- message)]
+(exception: #export (non-exhaustive-pattern-matching {input Code} {branches (List [Code Code])} {coverage Coverage})
+ (ex.report ["Input" (%code input)]
+ ["Branches" (%code (code.record branches))]
+ ["Coverage" (coverage.%coverage coverage)]))
- [cannot-have-empty-branches]
- [non-exhaustive-pattern-matching]
- )
+(exception: #export (cannot-have-empty-branches {message Text})
+ message)
(def: (re-quantify envs baseT)
(-> (List (List Type)) Type Type)
@@ -270,7 +270,7 @@
(analyse-pattern (#.Some (list.size group)) inputT (` ((~ (code.nat idx)) (~+ values))) next)))
_
- (///.throw unrecognized-pattern-syntax pattern)
+ (///.throw not-a-pattern pattern)
))
(def: #export (case analyse inputC branches)
@@ -292,7 +292,7 @@
outputTC (monad.map @ (|>> product.left coverage.determine) outputT)
_ (.case (monad.fold error.Monad<Error> coverage.merge outputHC outputTC)
(#error.Success coverage)
- (///.assert non-exhaustive-pattern-matching ""
+ (///.assert non-exhaustive-pattern-matching [inputC branches coverage]
(coverage.exhaustive? coverage))
(#error.Error error)