diff options
Diffstat (limited to 'new-luxc/test/test/luxc/lang/analysis/structure.lux')
-rw-r--r-- | new-luxc/test/test/luxc/lang/analysis/structure.lux | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/new-luxc/test/test/luxc/lang/analysis/structure.lux b/new-luxc/test/test/luxc/lang/analysis/structure.lux index 5694c0927..42177ebb4 100644 --- a/new-luxc/test/test/luxc/lang/analysis/structure.lux +++ b/new-luxc/test/test/luxc/lang/analysis/structure.lux @@ -185,15 +185,15 @@ true))) )))) -(def: (check-variant-inference variantT choice size analysis) - (-> Type Nat Nat (Meta [Module Scope Type la.Analysis]) Bool) +(def: (check-variant variantT choice size analysis) + (-> Type Nat Nat (Meta [Module Scope la.Analysis]) Bool) (|> analysis + (&.with-type variantT) (macro.run (init-compiler [])) - (case> (^multi (#e.Success [_ _ sumT sumA]) + (case> (^multi (#e.Success [_ _ sumA]) [(la.unfold-variant sumA) (#.Some [tag last? valueA])]) - (and (type/= variantT sumT) - (n/= tag choice) + (and (n/= tag choice) (bool/= last? (n/= (n/dec size) choice))) _ @@ -241,25 +241,22 @@ (do macro.Monad<Meta> [_ (@module.declare-tags tags false namedT)] (&.with-scope - (@common.with-unknown-type - (@.analyse-tagged-sum analyse [module-name choice-tag] choiceC))))) - (check-variant-inference variantT choice size))) + (@.analyse-tagged-sum analyse [module-name choice-tag] choiceC)))) + (check-variant variantT choice size))) (test "Tagged sums specialize when type-vars get bound." (|> (@module.with-module +0 module-name (do macro.Monad<Meta> [_ (@module.declare-tags tags false named-polyT)] (&.with-scope - (@common.with-unknown-type - (@.analyse-tagged-sum analyse [module-name choice-tag] choiceC))))) - (check-variant-inference variantT choice size))) + (@.analyse-tagged-sum analyse [module-name choice-tag] choiceC)))) + (check-variant variantT choice size))) (test "Tagged sum inference retains universal quantification when type-vars are not bound." (|> (@module.with-module +0 module-name (do macro.Monad<Meta> [_ (@module.declare-tags tags false named-polyT)] (&.with-scope - (@common.with-unknown-type - (@.analyse-tagged-sum analyse [module-name other-choice-tag] other-choiceC))))) - (check-variant-inference polyT other-choice size))) + (@.analyse-tagged-sum analyse [module-name other-choice-tag] other-choiceC)))) + (check-variant polyT other-choice size))) (test "Can specialize generic tagged sums." (|> (@module.with-module +0 module-name (do macro.Monad<Meta> |