diff options
Diffstat (limited to 'stdlib/source/lux/language/compiler/analysis/case')
-rw-r--r-- | stdlib/source/lux/language/compiler/analysis/case/coverage.lux | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index c19003df6..5c3ff1d72 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -1,20 +1,21 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)] equivalence] [data [bit ("bit/" Equivalence<Bit>)] - [number] + ["." number] ["e" error ("error/" Monad<Error>)] - [maybe] - [text format] + ["." maybe] + [text + format] [collection - [list ("list/" Fold<List>)] + ["." list ("list/" Fold<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [//// ("operation/" Monad<Operation>)] - [/// (#+ Pattern Variant Operation)]) + ["." //// ("operation/" Monad<Operation>)] + ["." /// (#+ Pattern Variant Operation)]) (def: cases (-> (Maybe Nat) Nat) @@ -174,7 +175,7 @@ _ #0))) -(open: "C/" Equivalence<Coverage>) +(open: "coverage/" Equivalence<Coverage>) ## After determining the coverage of each individual pattern, it is ## necessary to merge them all to figure out if the entire @@ -226,7 +227,7 @@ (#Variant allSF casesM))))) [(#Seq leftA rightA) (#Seq leftSF rightSF)] - (case [(C/= leftSF leftA) (C/= rightSF rightA)] + (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)] ## There is nothing the addition adds to the coverage. [#1 #1] redundant-pattern @@ -254,12 +255,12 @@ ## The left part will always match, so the addition is redundant. (^multi [(#Seq left right) single] - (C/= left single)) + (coverage/= left single)) redundant-pattern ## The right part is not necessary, since it can always match the left. (^multi [single (#Seq left right)] - (C/= left single)) + (coverage/= left single)) (error/wrap single) ## When merging a new coverage against one based on Alt, it may be @@ -317,7 +318,7 @@ (undefined))))) _ - (if (C/= so-far addition) + (if (coverage/= so-far addition) ## The addition cannot possibly improve the coverage. redundant-pattern ## There are now 2 alternative paths. |