aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/language/compiler/analysis/case
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/language/compiler/analysis/case.lux36
1 files changed, 19 insertions, 17 deletions
diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux
index d1ef6ece1..760ea3b03 100644
--- a/stdlib/source/lux/language/compiler/analysis/case.lux
+++ b/stdlib/source/lux/language/compiler/analysis/case.lux
@@ -12,15 +12,17 @@
[collection [list ("list/" Fold<List> Monoid<List> Functor<List>)]]]
["." macro
[code]]]
- [////
- ["." type
- ["tc" check]]
- [scope]]
- [///]
- [// (#+ Pattern Analysis Operation Compiler)]
- [//type]
- [//structure]
- [/coverage])
+ [// (#+ Pattern Analysis Operation Compiler)
+ [scope]
+ ["//." type]
+ [structure]
+ ["/." //
+ [extension]
+ [//
+ ["." type
+ ["tc" check]]]]]
+ [/
+ [coverage]])
(exception: #export (cannot-match-type-with-pattern {type Type} {pattern Code})
(ex.report ["Type" (%type type)]
@@ -215,8 +217,8 @@
[cursor (#.Record record)]
(do ///.Monad<Operation>
- [record (//structure.normalize record)
- [members recordT] (//structure.order record)
+ [record (structure.normalize record)
+ [members recordT] (structure.order record)
_ (//type.with-env
(tc.check inputT recordT))]
(analyse-pattern (#.Some (list.size members)) inputT [cursor (#.Tuple members)] next))
@@ -257,8 +259,8 @@
(^ [cursor (#.Form (list& [_ (#.Tag tag)] values))])
(//.with-cursor cursor
(do ///.Monad<Operation>
- [tag (macro.normalize tag)
- [idx group variantT] (macro.resolve-tag tag)
+ [tag (extension.lift (macro.normalize tag))
+ [idx group variantT] (extension.lift (macro.resolve-tag tag))
_ (//type.with-env
(tc.check inputT variantT))]
(analyse-pattern (#.Some (list.size group)) inputT (` ((~ (code.nat idx)) (~+ values))) next)))
@@ -282,12 +284,12 @@
(function (_ [patternT bodyT])
(analyse-pattern #.None inputT patternT (analyse bodyT)))
branchesT)
- outputHC (|> outputH product.left /coverage.determine)
- outputTC (monad.map @ (|>> product.left /coverage.determine) outputT)
- _ (.case (monad.fold error.Monad<Error> /coverage.merge outputHC outputTC)
+ outputHC (|> outputH product.left coverage.determine)
+ 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 ""
- (/coverage.exhaustive? coverage))
+ (coverage.exhaustive? coverage))
(#error.Error error)
(///.fail error))]