diff options
author | Eduardo Julian | 2017-10-18 12:42:46 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-18 12:42:46 -0400 |
commit | 901b09dada43ec6f3b21618800ec7400fda54a0d (patch) | |
tree | d62dde3df2ce4fd7d7cd8d0b177f6592f87817cb /new-luxc/test/test/luxc/analyser | |
parent | 14e381de130f0c8d3e333cf0523c6c98b9aa84b1 (diff) |
- Updated to the latest changes in stdlib.
Diffstat (limited to 'new-luxc/test/test/luxc/analyser')
-rw-r--r-- | new-luxc/test/test/luxc/analyser/case.lux | 18 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/common.lux | 14 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/function.lux | 48 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/primitive.lux | 16 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/procedure/common.lux | 54 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux | 16 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/reference.lux | 16 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/structure.lux | 102 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/analyser/type.lux | 24 |
9 files changed, 154 insertions, 154 deletions
diff --git a/new-luxc/test/test/luxc/analyser/case.lux b/new-luxc/test/test/luxc/analyser/case.lux index f75ebce00..e19ac3a0a 100644 --- a/new-luxc/test/test/luxc/analyser/case.lux +++ b/new-luxc/test/test/luxc/analyser/case.lux @@ -4,7 +4,7 @@ (control [monad #+ do] pipe) (data [bool "B/" Eq<Bool>] - ["R" result] + ["R" error] [product] [maybe] [text "T/" Eq<Text>] @@ -12,10 +12,10 @@ (coll [list "L/" Monad<List>] ["S" set])) ["r" math/random "r/" Monad<Random>] - [type "Type/" Eq<Type>] - (type ["tc" check]) - [macro #+ Monad<Lux>] - (macro [code]) + [meta #+ Monad<Meta>] + (meta [code] + [type "type/" Eq<Type>] + (type ["tc" check])) test) (luxc ["&" base] (lang ["la" analysis]) @@ -172,7 +172,7 @@ check-failure)) (test "Can analyse exhaustive pattern-matching." (|> (@module;with-module +0 module-name - (do Monad<Lux> + (do Monad<Meta> [_ (@module;declare-tags variant-tags false (#;Named [module-name variant-name] (type;variant primitivesT))) @@ -185,7 +185,7 @@ check-success)) (test "Will reject non-exhaustive pattern-matching." (|> (@module;with-module +0 module-name - (do Monad<Lux> + (do Monad<Meta> [_ (@module;declare-tags variant-tags false (#;Named [module-name variant-name] (type;variant primitivesT))) @@ -198,7 +198,7 @@ check-failure)) (test "Will reject redundant pattern-matching." (|> (@module;with-module +0 module-name - (do Monad<Lux> + (do Monad<Meta> [_ (@module;declare-tags variant-tags false (#;Named [module-name variant-name] (type;variant primitivesT))) @@ -211,7 +211,7 @@ check-failure)) (test "Will reject pattern-matching if the bodies of the branches do not all have the same type." (|> (@module;with-module +0 module-name - (do Monad<Lux> + (do Monad<Meta> [_ (@module;declare-tags variant-tags false (#;Named [module-name variant-name] (type;variant primitivesT))) diff --git a/new-luxc/test/test/luxc/analyser/common.lux b/new-luxc/test/test/luxc/analyser/common.lux index 60f3eef50..99090777b 100644 --- a/new-luxc/test/test/luxc/analyser/common.lux +++ b/new-luxc/test/test/luxc/analyser/common.lux @@ -2,9 +2,9 @@ lux (lux (control pipe) ["r" math/random "r/" Monad<Random>] - (data ["R" result]) - [macro] - (macro [code])) + (data ["e" error]) + [meta] + (meta [code])) (luxc ["&" base] [analyser] [eval]) @@ -38,13 +38,13 @@ (do-template [<name> <on-success> <on-failure>] [(def: #export (<name> analysis) - (All [a] (-> (Lux a) Bool)) + (All [a] (-> (Meta a) Bool)) (|> analysis - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) <on-success> - (#R;Error error) + (#e;Error error) <on-failure>)))] [check-success true false] diff --git a/new-luxc/test/test/luxc/analyser/function.lux b/new-luxc/test/test/luxc/analyser/function.lux index f26025034..4b74db183 100644 --- a/new-luxc/test/test/luxc/analyser/function.lux +++ b/new-luxc/test/test/luxc/analyser/function.lux @@ -3,16 +3,16 @@ (lux [io] (control [monad #+ do] pipe) - (data ["R" result] + (data ["e" error] [maybe] [product] [text "text/" Eq<Text>] text/format (coll [list "list/" Functor<List>])) ["r" math/random "r/" Monad<Random>] - [type "type/" Eq<Type>] - [macro] - (macro [code]) + [meta] + (meta [code] + [type "type/" Eq<Type>]) test) (luxc ["&" base] (lang ["la" analysis]) @@ -23,22 +23,22 @@ (.. common) (test/luxc common)) -(def: (check-type expectedT result) - (-> Type (R;Result [Type la;Analysis]) Bool) - (case result - (#R;Success [exprT exprA]) +(def: (check-type expectedT error) + (-> Type (e;Error [Type la;Analysis]) Bool) + (case error + (#e;Success [exprT exprA]) (type/= expectedT exprT) _ false)) -(def: (succeeds? result) - (All [a] (-> (R;Result a) Bool)) - (case result - (#R;Success _) +(def: (succeeds? error) + (All [a] (-> (e;Error a) Bool)) + (case error + (#e;Success _) true - (#R;Error _) + (#e;Error _) false)) (def: (flatten-apply analysis) @@ -52,15 +52,15 @@ [analysis (list)])) (def: (check-apply expectedT num-args analysis) - (-> Type Nat (Lux [Type la;Analysis]) Bool) + (-> Type Nat (Meta [Type la;Analysis]) Bool) (|> analysis - (macro;run (init-compiler [])) - (case> (#R;Success [applyT applyA]) + (meta;run (init-compiler [])) + (case> (#e;Success [applyT applyA]) (let [[funcA argsA] (flatten-apply applyA)] (and (type/= expectedT applyT) (n.= num-args (list;size argsA)))) - (#R;Error error) + (#e;Error error) false))) (context: "Function definition." @@ -72,36 +72,36 @@ (test "Can analyse function." (|> (&;with-expected-type (type (All [a] (-> a outputT))) (@;analyse-function analyse func-name arg-name outputC)) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) succeeds?)) (test "Generic functions can always be specialized." (and (|> (&;with-expected-type (-> inputT outputT) (@;analyse-function analyse func-name arg-name outputC)) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) succeeds?) (|> (&;with-expected-type (-> inputT inputT) (@;analyse-function analyse func-name arg-name (code;symbol ["" arg-name]))) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) succeeds?))) (test "Can infer function (constant output and unused input)." (|> (@common;with-unknown-type (@;analyse-function analyse func-name arg-name outputC)) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) (check-type (type (All [a] (-> a outputT)))))) (test "Can infer function (output = input)." (|> (@common;with-unknown-type (@;analyse-function analyse func-name arg-name (code;symbol ["" arg-name]))) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) (check-type (type (All [a] (-> a a)))))) (test "The function's name is bound to the function's type." (|> (&;with-expected-type (type (Rec self (-> inputT self))) (@;analyse-function analyse func-name arg-name (code;symbol ["" func-name]))) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) succeeds?)) (test "Can infer recursive types for functions." (|> (@common;with-unknown-type (@;analyse-function analyse func-name arg-name (code;symbol ["" func-name]))) - (macro;run (init-compiler [])) + (meta;run (init-compiler [])) (check-type (type (Rec self (All [a] (-> a self))))))) )) diff --git a/new-luxc/test/test/luxc/analyser/primitive.lux b/new-luxc/test/test/luxc/analyser/primitive.lux index e435ecca0..053587781 100644 --- a/new-luxc/test/test/luxc/analyser/primitive.lux +++ b/new-luxc/test/test/luxc/analyser/primitive.lux @@ -8,13 +8,13 @@ (text format ["l" lexer]) [number] - ["R" result] + ["e" error] [product] (coll [list "L/" Functor<List> Fold<List>])) - ["r" math/random "R/" Monad<Random>] - [type "Type/" Eq<Type>] - [macro #+ Monad<Lux>] - (macro [code]) + ["r" math/random] + [meta #+ Monad<Meta>] + (meta [code] + [type "type/" Eq<Type>]) test) (luxc ["&" base] ["&;" module] @@ -37,9 +37,9 @@ [(test (format "Can analyse " <desc> ".") (|> (@common;with-unknown-type (<analyser> <value>)) - (macro;run (init-compiler [])) - (case> (#R;Success [_type (<tag> value)]) - (and (Type/= <type> _type) + (meta;run (init-compiler [])) + (case> (#e;Success [_type (<tag> value)]) + (and (type/= <type> _type) (is <value> value)) _ diff --git a/new-luxc/test/test/luxc/analyser/procedure/common.lux b/new-luxc/test/test/luxc/analyser/procedure/common.lux index 5e834746a..ee342971b 100644 --- a/new-luxc/test/test/luxc/analyser/procedure/common.lux +++ b/new-luxc/test/test/luxc/analyser/procedure/common.lux @@ -5,13 +5,13 @@ pipe) (concurrency [atom]) (data text/format - ["R" result] + ["e" error] [product] (coll [array])) ["r" math/random "r/" Monad<Random>] - [type "Type/" Eq<Type>] - [macro #+ Monad<Lux>] - (macro [code]) + [meta #+ Monad<Meta>] + (meta [code] + [type "type/" Eq<Type>]) test) (luxc ["&" base] ["&;" scope] @@ -28,11 +28,11 @@ (-> Text (List Code) Type Bool) (|> (&;with-expected-type output-type (@;analyse-procedure analyse procedure params)) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) <success> - (#R;Error _) + (#e;Error _) <failure>)))] [check-success+ true false] @@ -42,7 +42,7 @@ (context: "Lux procedures" [[primT primC] gen-primitive [antiT antiC] (|> gen-primitive - (r;filter (|>. product;left (Type/= primT) not)))] + (r;filter (|>. product;left (type/= primT) not)))] ($_ seq (test "Can test for reference equality." (check-success+ "lux is" (list primC primC) Bool)) @@ -237,7 +237,7 @@ sizeC (|> r;nat (:: @ map code;nat)) idxC (|> r;nat (:: @ map code;nat)) var-name (r;text +5) - #let [arrayT (type (array;Array elemT))]] + #let [arrayT (type (Array elemT))]] ($_ seq (test "Can create arrays." (check-success+ "lux array new" (list sizeC) arrayT)) @@ -248,11 +248,11 @@ (@;analyse-procedure analyse "lux array get" (list idxC (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) (test "Can put a value inside an array." (|> (&scope;with-scope "" @@ -262,11 +262,11 @@ (list idxC elemC (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) (test "Can remove a value from an array." (|> (&scope;with-scope "" @@ -275,11 +275,11 @@ (@;analyse-procedure analyse "lux array remove" (list idxC (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) (test "Can query the size of an array." (|> (&scope;with-scope "" @@ -287,11 +287,11 @@ (&;with-expected-type Nat (@;analyse-procedure analyse "lux array size" (list (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) )) @@ -343,11 +343,11 @@ (&;with-expected-type elemT (@;analyse-procedure analyse "lux atom read" (list (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) (test "Can swap the value of an atomic reference." (|> (&scope;with-scope "" @@ -357,11 +357,11 @@ (list elemC elemC (code;symbol ["" var-name])))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error _) + (#e;Error _) false))) )) diff --git a/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux b/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux index 49d51eb3c..5cf359ad0 100644 --- a/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux @@ -4,7 +4,7 @@ (control [monad #+ do] pipe) (concurrency [atom]) - (data ["R" result] + (data ["e" error] [product] [maybe] [text "text/" Eq<Text>] @@ -13,9 +13,9 @@ [list "list/" Fold<List>] [dict])) ["r" math/random "r/" Monad<Random>] - [type] - [macro #+ Monad<Lux>] - (macro [code]) + [meta #+ Monad<Meta>] + (meta [code] + [type]) test) (luxc ["&" base] ["&;" scope] @@ -32,16 +32,16 @@ (do-template [<name> <success> <failure>] [(def: (<name> procedure params output-type) (-> Text (List Code) Type Bool) - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate] (&;with-scope (&;with-expected-type output-type (@;analyse-procedure analyse procedure params)))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) <success> - (#R;Error error) + (#e;Error error) <failure>)))] [success true false] diff --git a/new-luxc/test/test/luxc/analyser/reference.lux b/new-luxc/test/test/luxc/analyser/reference.lux index 5cc607080..8ffdf15b7 100644 --- a/new-luxc/test/test/luxc/analyser/reference.lux +++ b/new-luxc/test/test/luxc/analyser/reference.lux @@ -3,10 +3,10 @@ (lux [io] (control [monad #+ do] pipe) - (data ["R" result]) + (data ["e" error]) ["r" math/random] - [type "type/" Eq<Type>] - [macro #+ Monad<Lux>] + [meta #+ Monad<Meta>] + (meta [type "type/" Eq<Type>]) test) (luxc ["&;" scope] ["&;" module] @@ -28,21 +28,21 @@ (&scope;with-local [var-name ref-type] (@common;with-unknown-type (@;analyse-reference ["" var-name])))) - (macro;run (init-compiler [])) - (case> (#R;Success [_type (#~;Variable idx)]) + (meta;run (init-compiler [])) + (case> (#e;Success [_type (#~;Variable idx)]) (type/= ref-type _type) _ false))) (test "Can analyse definition." - (|> (do Monad<Lux> + (|> (do Monad<Meta> [_ (&module;create +0 module-name) _ (&module;define [module-name var-name] [ref-type (' {}) (:! Void [])])] (@common;with-unknown-type (@;analyse-reference [module-name var-name]))) - (macro;run (init-compiler [])) - (case> (#R;Success [_type (#~;Definition idx)]) + (meta;run (init-compiler [])) + (case> (#e;Success [_type (#~;Definition idx)]) (type/= ref-type _type) _ diff --git a/new-luxc/test/test/luxc/analyser/structure.lux b/new-luxc/test/test/luxc/analyser/structure.lux index d4d915364..7ac9c29c9 100644 --- a/new-luxc/test/test/luxc/analyser/structure.lux +++ b/new-luxc/test/test/luxc/analyser/structure.lux @@ -4,7 +4,7 @@ (control [monad #+ do] pipe) (data [bool "bool/" Eq<Bool>] - ["R" result] + ["e" error] [product] [maybe] [text] @@ -12,10 +12,10 @@ (coll [list "list/" Functor<List>] ["S" set])) ["r" math/random "r/" Monad<Random>] - [type "type/" Eq<Type>] - (type ["tc" check]) - [macro] - (macro [code]) + [meta] + (meta [code] + [type "type/" Eq<Type>] + (type ["tc" check])) test) (luxc ["&" base] (lang ["la" analysis]) @@ -75,8 +75,8 @@ (|> (&;with-scope (&;with-expected-type variantT (@;analyse-sum analyse choice valueC))) - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ sumA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ sumA]) [(flatten-variant sumA) (#;Some [tag last? valueA])]) (and (n.= tag choice) @@ -88,13 +88,13 @@ (|> (&;with-scope (@common;with-var (function [[var-id varT]] - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (&;with-type-env (tc;check varT variantT))] (&;with-expected-type varT (@;analyse-sum analyse choice valueC)))))) - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ sumA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ sumA]) [(flatten-variant sumA) (#;Some [tag last? valueA])]) (and (n.= tag choice) @@ -108,8 +108,8 @@ (function [[var-id varT]] (&;with-expected-type varT (@;analyse-sum analyse choice valueC))))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) false _ @@ -118,21 +118,21 @@ (|> (&;with-scope (&;with-expected-type (type;ex-q +1 +variantT) (@;analyse-sum analyse +choice +valueC))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error error) + (#e;Error error) false))) (test "Can analyse sum through universal quantification." (|> (&;with-scope (&;with-expected-type (type;univ-q +1 +variantT) (@;analyse-sum analyse +choice +valueC))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) (not (n.= choice +choice)) - (#R;Error error) + (#e;Error error) (n.= choice +choice)))) )) @@ -150,8 +150,8 @@ (test "Can analyse product." (|> (&;with-expected-type (type;tuple (list/map product;left primitives)) (@;analyse-product analyse (list/map product;right primitives))) - (macro;run (init-compiler [])) - (case> (#R;Success tupleA) + (meta;run (init-compiler [])) + (case> (#e;Success tupleA) (n.= size (list;size (flatten-tuple tupleA))) _ @@ -159,8 +159,8 @@ (test "Can infer product." (|> (@common;with-unknown-type (@;analyse-product analyse (list/map product;right primitives))) - (macro;run (init-compiler [])) - (case> (#R;Success [_type tupleA]) + (meta;run (init-compiler [])) + (case> (#e;Success [_type tupleA]) (and (type/= (type;tuple (list/map product;left primitives)) _type) (n.= size (list;size (flatten-tuple tupleA)))) @@ -170,23 +170,23 @@ (test "Can analyse pseudo-product (singleton tuple)" (|> (&;with-expected-type singletonT (analyse (` [(~ singletonC)]))) - (macro;run (init-compiler [])) - (case> (#R;Success singletonA) + (meta;run (init-compiler [])) + (case> (#e;Success singletonA) true - (#R;Error error) + (#e;Error error) false))) (test "Can analyse product through bound type-vars." (|> (&;with-scope (@common;with-var (function [[var-id varT]] - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (&;with-type-env (tc;check varT (type;tuple (list/map product;left primitives))))] (&;with-expected-type varT (@;analyse-product analyse (list/map product;right primitives))))))) - (macro;run (init-compiler [])) - (case> (#R;Success [_ tupleA]) + (meta;run (init-compiler [])) + (case> (#e;Success [_ tupleA]) (n.= size (list;size (flatten-tuple tupleA))) _ @@ -195,29 +195,29 @@ (|> (&;with-scope (&;with-expected-type (type;ex-q +1 +tupleT) (@;analyse-product analyse (list/map product;right +primitives)))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) true - (#R;Error error) + (#e;Error error) false))) (test "Cannot analyse product through universal quantification." (|> (&;with-scope (&;with-expected-type (type;univ-q +1 +tupleT) (@;analyse-product analyse (list/map product;right +primitives)))) - (macro;run (init-compiler [])) - (case> (#R;Success _) + (meta;run (init-compiler [])) + (case> (#e;Success _) false - (#R;Error error) + (#e;Error error) true))) )) (def: (check-variant-inference variantT choice size analysis) - (-> Type Nat Nat (Lux [Module Scope Type la;Analysis]) Bool) + (-> Type Nat Nat (Meta [Module Scope Type la;Analysis]) Bool) (|> analysis - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ _ sumT sumA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ _ sumT sumA]) [(flatten-variant sumA) (#;Some [tag last? valueA])]) (and (type/= variantT sumT) @@ -228,10 +228,10 @@ false))) (def: (check-record-inference tupleT size analysis) - (-> Type Nat (Lux [Module Scope Type la;Analysis]) Bool) + (-> Type Nat (Meta [Module Scope Type la;Analysis]) Bool) (|> analysis - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ _ productT productA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ _ productT productA]) [(flatten-tuple productA) membersA]) (and (type/= tupleT productT) @@ -264,7 +264,7 @@ ($_ seq (test "Can infer tagged sum." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false namedT)] (&;with-scope (@common;with-unknown-type @@ -272,7 +272,7 @@ (check-variant-inference variantT choice size))) (test "Tagged sums specialize when type-vars get bound." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false named-polyT)] (&;with-scope (@common;with-unknown-type @@ -280,7 +280,7 @@ (check-variant-inference 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<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false named-polyT)] (&;with-scope (@common;with-unknown-type @@ -288,13 +288,13 @@ (check-variant-inference polyT other-choice size))) (test "Can specialize generic tagged sums." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false named-polyT)] (&;with-scope (&;with-expected-type variantT (@;analyse-tagged-sum analyse [module-name other-choice-tag] other-choiceC))))) - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ _ sumA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ _ sumA]) [(flatten-variant sumA) (#;Some [tag last? valueA])]) (and (n.= tag other-choice) @@ -326,7 +326,7 @@ ($_ seq (test "Can infer record." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false namedT)] (&;with-scope (@common;with-unknown-type @@ -334,7 +334,7 @@ (check-record-inference tupleT size))) (test "Records specialize when type-vars get bound." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false named-polyT)] (&;with-scope (@common;with-unknown-type @@ -342,13 +342,13 @@ (check-record-inference tupleT size))) (test "Can specialize generic records." (|> (@module;with-module +0 module-name - (do macro;Monad<Lux> + (do meta;Monad<Meta> [_ (@module;declare-tags tags false named-polyT)] (&;with-scope (&;with-expected-type tupleT (@;analyse-record analyse recordC))))) - (macro;run (init-compiler [])) - (case> (^multi (#R;Success [_ _ productA]) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success [_ _ productA]) [(flatten-tuple productA) membersA]) (n.= size (list;size membersA)) diff --git a/new-luxc/test/test/luxc/analyser/type.lux b/new-luxc/test/test/luxc/analyser/type.lux index b23b16d6a..87def3dad 100644 --- a/new-luxc/test/test/luxc/analyser/type.lux +++ b/new-luxc/test/test/luxc/analyser/type.lux @@ -8,13 +8,13 @@ (text format ["l" lexer]) [number] - ["R" result] + ["e" error] [product] (coll [list "list/" Functor<List> Fold<List>])) ["r" math/random "r/" Monad<Random>] - [type "type/" Eq<Type>] - [macro #+ Monad<Lux>] - (macro [code]) + [meta #+ Monad<Meta>] + (meta [code] + [type "type/" Eq<Type>]) test) (luxc ["&" base] ["&;" module] @@ -50,13 +50,13 @@ [[typeC codeT exprC] check] ($_ seq (test (format "Can analyse type-checking.") - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate] (&;with-scope (@common;with-unknown-type (@;analyse-check analyse eval;eval typeC exprC)))) - (macro;run (init-compiler [])) - (case> (#R;Success [_ [analysisT analysisA]]) + (meta;run (init-compiler [])) + (case> (#e;Success [_ [analysisT analysisA]]) (and (type/= codeT analysisT) (case [exprC analysisA] (^template [<expected> <actual> <test>] @@ -72,18 +72,18 @@ _ false)) - (#R;Error error) + (#e;Error error) false))) (test (format "Can analyse type-coercion.") - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate] (&;with-scope (@common;with-unknown-type (@;analyse-coerce analyse eval;eval typeC exprC)))) - (macro;run (init-compiler [])) - (case> (#R;Success [_ [analysisT analysisA]]) + (meta;run (init-compiler [])) + (case> (#e;Success [_ [analysisT analysisA]]) (type/= codeT analysisT) - (#R;Error error) + (#e;Error error) false))) )) |