diff options
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux | 20 | ||||
-rw-r--r-- | stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux | 12 |
2 files changed, 18 insertions, 14 deletions
diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux index 9a17deaec..c5165fca7 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux @@ -61,9 +61,7 @@ (|> analysis (typeA.with-type type) (phase.run _primitive.state) - (case> (^multi (#e.Success sumA) - [(analysis.variant sumA) - (#.Some variant)]) + (case> (^ (#e.Success (analysis.variant variant))) (check-sum' size tag variant) _ @@ -81,9 +79,7 @@ (tagged module tags type) (typeA.with-type type) (phase.run _primitive.state) - (case> (^multi (#e.Success [_ sumA]) - [(analysis.variant sumA) - (#.Some variant)]) + (case> (^ (#e.Success [_ (analysis.variant variant)])) (check-sum' size tag variant) _ @@ -91,7 +87,13 @@ (def: (right-size? size) (-> Nat (-> Analysis Bit)) - (|>> analysis.tuple list.size (n/= size))) + (|>> (case> (^ (analysis.tuple elems)) + (|> elems + list.size + (n/= size)) + + _ + false))) (def: (check-record-inference module tags type size analysis) (-> Text (List module.Tag) Type Nat (Operation [Type Analysis]) Bit) @@ -133,9 +135,7 @@ (typeA.with-type varT (/.sum _primitive.phase choice valueC))) (phase.run _primitive.state) - (case> (^multi (#e.Success sumA) - [(analysis.variant sumA) - (#.Some variant)]) + (case> (^ (#e.Success (analysis.variant variant))) (check-sum' size choice variant) _ diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux index a78aa1a09..fa93777b2 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux @@ -27,13 +27,17 @@ (do @ [size (|> r.nat (:: @ map (|>> (n/% 10) (n/+ 2)))) tagA (|> r.nat (:: @ map (n/% size))) + #let [right? (n/= (dec size) tagA) + lefts (if right? + (dec tagA) + tagA)] memberA //primitive.primitive] ($_ seq (test "Can synthesize variants." - (|> (analysis.sum-analysis size tagA memberA) + (|> (analysis.variant [lefts right? memberA]) expression.phase (phase.run [bundle.empty //.init]) - (case> (#error.Success (#//.Structure (#//.Variant [leftsS right?S valueS]))) + (case> (^ (#error.Success (//.variant [leftsS right?S valueS]))) (let [tagS (if right?S (inc leftsS) leftsS)] (and (n/= tagA tagS) (|> tagS (n/= (dec size)) (bit/= right?S)) @@ -50,10 +54,10 @@ membersA (r.list size //primitive.primitive)] ($_ seq (test "Can synthesize tuple." - (|> (analysis.product-analysis membersA) + (|> (analysis.tuple membersA) expression.phase (phase.run [bundle.empty //.init]) - (case> (#error.Success (#//.Structure (#//.Tuple membersS))) + (case> (^ (#error.Success (//.tuple membersS))) (and (n/= size (list.size membersS)) (list.every? (product.uncurry //primitive.corresponds?) (list.zip2 membersA membersS))) |