diff options
Diffstat (limited to 'new-luxc/test')
18 files changed, 359 insertions, 359 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))) )) diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 7c1444e01..36e13c2a3 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -2,19 +2,19 @@ lux (lux (control pipe) ["r" math/random "r/" Monad<Random>] - (data ["R" result]) - [macro] - (macro [code]) + (data ["R" error]) + [meta] + (meta [code]) [io]) (luxc ["&" base] [analyser] ["&;" host])) -(def: init-compiler-info - Compiler-Info - {#;compiler-name "Lux/JVM" - #;compiler-version &;compiler-version - #;compiler-mode #;Build}) +(def: init-info + Info + {#;target "JVM" + #;version &;version + #;mode #;Build}) (def: init-type-context Type-Context @@ -24,7 +24,7 @@ (def: #export (init-compiler _) (-> Top Compiler) - {#;info init-compiler-info + {#;info init-info #;source [dummy-cursor ""] #;cursor dummy-cursor #;modules (list) diff --git a/new-luxc/test/test/luxc/generator/case.lux b/new-luxc/test/test/luxc/generator/case.lux index 4aff49779..ab6c0f189 100644 --- a/new-luxc/test/test/luxc/generator/case.lux +++ b/new-luxc/test/test/luxc/generator/case.lux @@ -5,15 +5,15 @@ pipe) (data text/format [product] - ["R" result] + ["e" error] [bool "B/" Eq<Bool>] [text "T/" Eq<Text>] (coll ["a" array] [list "L/" Functor<List>] ["S" set])) ["r" math/random "r/" Monad<Random>] - [macro #+ Monad<Lux>] - (macro [code]) + [meta #+ Monad<Meta>] + (meta [code]) [host] test) (luxc (lang ["ls" synthesis]) @@ -79,26 +79,26 @@ to-bind r;nat] ($_ seq (test "Can generate pattern-matching." - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate valueS (#ls;AltP (#ls;SeqP path (#ls;ExecP (#ls;Bool true))) (#ls;SeqP (#ls;BindP +0) (#ls;ExecP (#ls;Bool false)))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (:! Bool valueG) _ false))) (test "Can bind values." - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Nat to-bind) (#ls;SeqP (#ls;BindP +1) (#ls;ExecP (#ls;Variable 1))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= to-bind (:! Nat valueG)) _ diff --git a/new-luxc/test/test/luxc/generator/function.lux b/new-luxc/test/test/luxc/generator/function.lux index 3757c0937..9ce59c037 100644 --- a/new-luxc/test/test/luxc/generator/function.lux +++ b/new-luxc/test/test/luxc/generator/function.lux @@ -5,12 +5,12 @@ pipe) (data [product] [maybe] - ["R" result] + ["e" error] (coll ["a" array] [list "list/" Functor<List>])) ["r" math/random "r/" Monad<Random>] - [macro] - (macro [code]) + [meta] + (meta [code]) [host] test) (luxc (lang ["ls" synthesis]) @@ -46,34 +46,34 @@ cut-off (|> cut-off (n.min (n.dec last-arg)))]] ($_ seq (test "Can read arguments." - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@expr;generate (#ls;Call argsS functionS))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= arg-value (:! Nat valueG)) - (#R;Error error) + (#e;Error error) false))) (test "Can partially apply functions." (or (n.= +1 arity) - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [#let [partial-arity (n.inc cut-off) preS (list;take partial-arity argsS) postS (list;drop partial-arity argsS)] runtime-bytecode @runtime;generate sampleI (@expr;generate (|> functionS (#ls;Call preS) (#ls;Call postS)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= arg-value (:! Nat valueG)) - (#R;Error error) + (#e;Error error) false)))) (test "Can read environment." (or (n.= +1 arity) - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [#let [env (|> (list;n.range +0 cut-off) (list/map (|>. n.inc nat-to-int))) super-arity (n.inc cut-off) @@ -87,10 +87,10 @@ runtime-bytecode @runtime;generate sampleI (@expr;generate (#ls;Call argsS functionS))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= arg-value (:! Nat valueG)) - (#R;Error error) + (#e;Error error) false)))) )) diff --git a/new-luxc/test/test/luxc/generator/primitive.lux b/new-luxc/test/test/luxc/generator/primitive.lux index 581a26bdb..e8470bf5a 100644 --- a/new-luxc/test/test/luxc/generator/primitive.lux +++ b/new-luxc/test/test/luxc/generator/primitive.lux @@ -4,11 +4,11 @@ (control [monad #+ do] pipe) (data text/format - ["R" result] + ["e" error] [bool "B/" Eq<Bool>] [text "T/" Eq<Text>]) - ["r" math/random "R/" Monad<Random>] - [macro] + ["r" math/random] + [meta] test) (luxc (lang ["ls" synthesis]) [analyser] @@ -29,11 +29,11 @@ (with-expansions [<tests> (do-template [<desc> <type> <synthesis> <sample> <test>] [(test (format "Can generate " <desc> ".") - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (<synthesis> <sample>))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> <sample> (:! <type> valueG)) _ @@ -47,11 +47,11 @@ ["text" Text #ls;Text %text% T/=])] ($_ seq (test "Can generate unit." - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate #ls;Unit)] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (is @runtime;unit (:! Text valueG)) _ diff --git a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux b/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux index 20e19fb5f..f617aba1e 100644 --- a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux @@ -5,14 +5,14 @@ pipe) (data text/format [bit] - ["R" result] + ["e" error] [bool "bool/" Eq<Bool>] [text "text/" Eq<Text>] [number "n/" Interval<Nat> "i/" Interval<Int> "r/" Interval<Frac> "d/" Interval<Deg>] (coll ["a" array] [list])) ["r" math/random "r/" Monad<Random>] - [macro #+ Monad<Lux>] + [meta #+ Monad<Meta>] [host] test) (luxc (lang ["ls" synthesis]) @@ -29,13 +29,13 @@ subject r;nat] (with-expansions [<binary> (do-template [<name> <reference>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list (#ls;Nat subject) (#ls;Nat param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= (<reference> param subject) (:! Nat valueG)) _ @@ -49,11 +49,11 @@ )] ($_ seq (test "bit count" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "bit count" (list (#ls;Nat subject))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= (bit;count subject) (:! Nat valueG)) _ @@ -61,13 +61,13 @@ <binary> (test "bit shift-right" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "bit shift-right" (list (#ls;Int (nat-to-int subject)) (#ls;Nat param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (i.= (bit;signed-shift-right param (nat-to-int subject)) (:! Int valueG)) @@ -80,11 +80,11 @@ subject r;nat] (with-expansions [<nullary> (do-template [<name> <reference>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= <reference> (:! Nat valueG)) _ @@ -95,11 +95,11 @@ ) <unary> (do-template [<name> <type> <prepare> <comp>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list (#ls;Nat subject))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<prepare> subject) (:! <type> valueG)) _ @@ -110,14 +110,14 @@ ) <binary> (do-template [<name> <reference> <outputT> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Nat subject) (#ls;Nat param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<reference> param subject) (:! <outputT> valueG)) _ @@ -142,11 +142,11 @@ subject r;int] (with-expansions [<nullary> (do-template [<name> <reference>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (i.= <reference> (:! Int valueG)) _ @@ -157,11 +157,11 @@ ) <unary> (do-template [<name> <type> <prepare> <comp>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list (#ls;Int subject))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<prepare> subject) (:! <type> valueG)) _ @@ -172,14 +172,14 @@ ) <binary> (do-template [<name> <reference> <outputT> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Int subject) (#ls;Int param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<reference> param subject) (:! <outputT> valueG)) _ @@ -204,14 +204,14 @@ subject r;frac] (with-expansions [<binary> (do-template [<name> <reference> <outputT> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Frac subject) (#ls;Frac param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<reference> param subject) (:! <outputT> valueG)) _ @@ -234,11 +234,11 @@ subject r;frac] (with-expansions [<nullary> (do-template [<name> <test>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> (:! Frac valueG)) _ @@ -253,12 +253,12 @@ ) <unary> (do-template [<name> <type> <prepare> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Frac subject))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<prepare> subject) (:! <type> valueG)) _ @@ -271,14 +271,14 @@ <nullary> <unary> (test "frac encode|decode" - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (|> (#ls;Frac subject) (list) (#ls;Procedure "frac encode") (list) (#ls;Procedure "frac decode")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (^multi (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (^multi (#e;Success valueG) [(:! (Maybe Frac) valueG) (#;Some value)]) (f.= subject value) @@ -293,11 +293,11 @@ subject r;deg] (with-expansions [<nullary> (do-template [<name> <reference>] [(test <name> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <name> (list)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (d.= <reference> (:! Deg valueG)) _ @@ -308,12 +308,12 @@ ) <unary> (do-template [<name> <type> <prepare> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Deg subject))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<prepare> subject) (:! <type> valueG)) _ @@ -323,14 +323,14 @@ ) <binary> (do-template [<name> <reference> <outputT> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Deg subject) (#ls;Deg param))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<reference> param subject) (:! <outputT> valueG)) _ @@ -346,14 +346,14 @@ ) <special> (do-template [<name> <reference> <outputT> <comp>] [(test <name> - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Procedure <name> (list (#ls;Deg subject) (#ls;Nat special))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<comp> (<reference> special subject) (:! <outputT> valueG)) _ diff --git a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux b/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux index 8f8728112..0cfd47538 100644 --- a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux @@ -4,7 +4,7 @@ (control [monad #+ do] pipe) (data [maybe] - ["R" result] + ["e" error] [bit] [bool "bool/" Eq<Bool>] [number "int/" Number<Int>] @@ -12,7 +12,7 @@ text/format (coll [list])) ["r" math/random "r/" Monad<Random>] - [macro #+ Monad<Lux>] + [meta #+ Monad<Meta>] [host] test) (luxc (lang ["ls" synthesis]) @@ -29,16 +29,16 @@ #let [frac-sample (int-to-frac int-sample)]] (with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2>) - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (<tag> <sample>) (list) (#ls;Procedure <step1>) (list) (#ls;Procedure <step2>)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> <sample> (:! <cast> valueG)) - (#R;Error error) + (#e;Error error) false)))] ["jvm convert double-to-float" "jvm convert float-to-double" #ls;Frac frac-sample Frac f.=] @@ -59,17 +59,17 @@ #let [frac-sample (int-to-frac int-sample)]] (with-expansions [<3step> (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (<tag> <sample>) (list) (#ls;Procedure <step1>) (list) (#ls;Procedure <step2>) (list) (#ls;Procedure <step3>)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> <sample> (:! <cast> valueG)) - (#R;Error error) + (#e;Error error) false)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-long" #ls;Int int-sample Int i.=] @@ -80,18 +80,18 @@ ) <4step> (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (<tag> <sample>) (list) (#ls;Procedure <step1>) (list) (#ls;Procedure <step2>) (list) (#ls;Procedure <step3>) (list) (#ls;Procedure <step4>)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> <sample> (:! <cast> valueG)) - (#R;Error error) + (#e;Error error) false)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" #ls;Int int-sample Int i.=] @@ -124,16 +124,16 @@ #let [subject (<augmentation> param)]] (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<pre> (<tag> subject)) (<pre> (<tag> param))))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> (<reference> param subject) (:! <type> valueG)) - (#R;Error error) + (#e;Error error) false)))] [(format "jvm " <domain> " +") <+>] @@ -159,16 +159,16 @@ #let [shift (n.% +10 param)]] (with-expansions [<combiners> (do-template [<procedure> <reference>] [(test <procedure> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<convert> (#ls;Nat subject)) (<convert> (#ls;Nat param))))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (n.= (<reference> param subject) (:! Nat valueG)) - (#R;Error error) + (#e;Error error) false)))] [(format "jvm " <domain> " and") bit;and] @@ -177,18 +177,18 @@ ) <shifters> (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] [(test <procedure> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (<post> (#ls;Procedure <procedure> (list (<convert> (<pre> subject)) (|> (#ls;Nat shift) (list) (#ls;Procedure "jvm convert long-to-int"))))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (<test> (<reference> shift (<pre-subject> subject)) (:! <type> valueG)) - (#R;Error error) + (#e;Error error) false)))] [(format "jvm " <domain> " shl") bit;shift-left Nat n.= id #ls;Nat] @@ -210,16 +210,16 @@ subject <generator>] (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure <procedure> (list (<pre> (<tag> subject)) (<pre> (<tag> param)))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) (bool/= (<reference> param subject) (:! Bool valueG)) - (#R;Error error) + (#e;Error error) false)))] [(format "jvm " <domain> " =") <=>] @@ -250,17 +250,17 @@ valueC gen-int] (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text <class>) (#ls;Nat size))) (list (#ls;Text <class>) (#ls;Nat idx) <input>) (#ls;Procedure "jvm array write") (list (#ls;Text <class>) (#ls;Nat idx)) (#ls;Procedure "jvm array read") <post>))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputZ) + (meta;run (init-compiler [])) + (case> (#e;Success outputZ) (<test> <value> (:! <type> outputZ)) - (#R;Error error) + (#e;Error error) false)))] ["boolean" Bool valueZ bool/= (#ls;Bool valueZ) id] @@ -296,17 +296,17 @@ valueC gen-int] (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text <class>) (#ls;Nat size))) (list (#ls;Text <class>) (#ls;Nat idx) <input>) (#ls;Procedure "jvm array write") (list (#ls;Text <class>) (#ls;Nat idx)) (#ls;Procedure "jvm array read") <post>))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (<test> <value> (:! <type> outputG)) - (#R;Error error) + (#e;Error error) false)))] ["char" Int valueC i.= (|> (#ls;Int valueC) @@ -318,7 +318,7 @@ ($_ seq <array> (test "java.lang.Double (level 1)" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [#let [inner (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text "java.lang.Double") (#ls;Nat size))) (list (#ls;Text "java.lang.Double") (#ls;Nat idx) (#ls;Frac valueD)) (#ls;Procedure "jvm array write"))] sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +1) (#ls;Text "java.lang.Double") (#ls;Nat size))) @@ -326,22 +326,22 @@ (list (#ls;Text "#Array") (#ls;Nat idx)) (#ls;Procedure "jvm array read") (list (#ls;Text "java.lang.Double") (#ls;Nat idx)) (#ls;Procedure "jvm array read")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (f.= valueD (:! Frac outputG)) - (#R;Error error) + (#e;Error error) false))) (test "jvm array length" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Procedure "jvm array new" (list (#ls;Nat +0) (#ls;Text "java.lang.Object") (#ls;Nat size))) (list) (#ls;Procedure "jvm array length")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (n.= size (:! Nat outputG)) - (#R;Error error) + (#e;Error error) false))) ))) @@ -380,61 +380,61 @@ instance instance-gen] ($_ seq (test "jvm object null" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Procedure "jvm object null" (list)) (list) (#ls;Procedure "jvm object null?")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (:! Bool outputG) - (#R;Error error) + (#e;Error error) false))) (test "jvm object null?" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Int sample) (list) (#ls;Procedure "jvm object null?")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (not (:! Bool outputG)) - (#R;Error error) + (#e;Error error) false))) (test "jvm object synchronized" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "jvm object synchronized" (list (#ls;Int monitor) (#ls;Int sample))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (i.= sample (:! Int outputG)) - (#R;Error error) + (#e;Error error) false))) (test "jvm object throw" false) (test "jvm object class" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "jvm object class" (list (#ls;Text class))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (|> outputG (:! Class) (Class.getName []) (text/= class)) - (#R;Error error) + (#e;Error error) false))) (test "jvm object instance?" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "jvm object instance?" (list (#ls;Text instance-class) instance)))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (:! Bool outputG) - (#R;Error error) + (#e;Error error) false))) )) @@ -444,26 +444,26 @@ (context: "Member [Field]" ($_ seq (test "jvm member static get" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (|> (#ls;Procedure "jvm member static get" (list (#ls;Text "java.util.GregorianCalendar") (#ls;Text "AD") (#ls;Text "int"))) (list) (#ls;Procedure "jvm convert int-to-long")))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (i.= GregorianCalendar.AD (:! Int outputG)) - (#R;Error error) + (#e;Error error) false))) (test "jvm member static put" - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Procedure "jvm member static put" (list (#ls;Text "java.awt.datatransfer.DataFlavor") (#ls;Text "allHtmlFlavor") (#ls;Text "java.awt.datatransfer.DataFlavor") (#ls;Procedure "jvm member static get" (list (#ls;Text "java.awt.datatransfer.DataFlavor") (#ls;Text "allHtmlFlavor") (#ls;Text "java.awt.datatransfer.DataFlavor"))))))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success outputG) + (meta;run (init-compiler [])) + (case> (#e;Success outputG) (is @runtime;unit (:! Text outputG)) - (#R;Error error) + (#e;Error error) false))) (test "jvm member virtual get" false) diff --git a/new-luxc/test/test/luxc/generator/structure.lux b/new-luxc/test/test/luxc/generator/structure.lux index fb15588ea..a5a3e66a9 100644 --- a/new-luxc/test/test/luxc/generator/structure.lux +++ b/new-luxc/test/test/luxc/generator/structure.lux @@ -3,15 +3,15 @@ (lux [io] (control [monad #+ do] pipe) - (data ["R" result] + (data ["e" error] [maybe] [bool "bool/" Eq<Bool>] [text "text/" Eq<Text>] text/format - (coll ["a" array] + (coll [array] [list])) ["r" math/random "r/" Monad<Random>] - [macro #+ Monad<Lux>] + [meta #+ Monad<Meta>] [host] test) (luxc (lang ["ls" synthesis]) @@ -44,10 +44,10 @@ (^template [<tag> <type> <test>] (<tag> prediction') (case (host;try (<test> prediction' (:! <type> sample))) - (#R;Success result) + (#e;Success result) result - (#R;Error error) + (#e;Error error) false)) ([#ls;Bool Bool bool/=] [#ls;Nat Nat n.=] @@ -64,14 +64,14 @@ [size (|> r;nat (:: @ map (|>. (n.% +10) (n.max +2)))) members (r;list size gen-primitive)] (test "Can generate tuple." - (|> (do macro;Monad<Lux> + (|> (do meta;Monad<Meta> [sampleI (@;generate (#ls;Tuple members))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) - (let [valueG (:! (a;Array Top) valueG)] - (and (n.= size (a;size valueG)) - (list;every? corresponds? (list;zip2 members (a;to-list valueG))))) + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (let [valueG (:! (Array Top) valueG)] + (and (n.= size (array;size valueG)) + (list;every? corresponds? (list;zip2 members (array;to-list valueG))))) _ false)))) @@ -82,17 +82,17 @@ #let [last? (n.= (n.dec num-tags) tag)] member gen-primitive] (test "Can generate variant." - (|> (do Monad<Lux> + (|> (do Monad<Meta> [runtime-bytecode @runtime;generate sampleI (@;generate (#ls;Variant tag last? member))] (@eval;eval sampleI)) - (macro;run (init-compiler [])) - (case> (#R;Success valueG) - (let [valueG (:! (a;Array Top) valueG)] - (and (n.= +3 (a;size valueG)) - (let [_tag (:! Integer (maybe;assume (a;get +0 valueG))) - _last? (a;get +1 valueG) - _value (:! Top (maybe;assume (a;get +2 valueG)))] + (meta;run (init-compiler [])) + (case> (#e;Success valueG) + (let [valueG (:! (Array Top) valueG)] + (and (n.= +3 (array;size valueG)) + (let [_tag (:! Integer (maybe;assume (array;read +0 valueG))) + _last? (array;read +1 valueG) + _value (:! Top (maybe;assume (array;read +2 valueG)))] (and (n.= tag (|> _tag host;i2l int-to-nat)) (case _last? (#;Some _last?') diff --git a/new-luxc/test/test/luxc/parser.lux b/new-luxc/test/test/luxc/parser.lux index a7708e1e5..ca980aa87 100644 --- a/new-luxc/test/test/luxc/parser.lux +++ b/new-luxc/test/test/luxc/parser.lux @@ -3,13 +3,13 @@ (lux [io] (control [monad #+ do]) (data [number] - ["R" result] + ["e" error] [text] (text format ["l" lexer]) (coll [list])) ["r" math/random "r/" Monad<Random>] - (macro [code]) + (meta [code]) test) (luxc ["&" parser])) @@ -78,10 +78,10 @@ [sample code^] (test "Can parse Lux code." (case (&;parse [default-cursor (code;to-text sample)]) - (#R;Error error) + (#e;Error error) false - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed sample)) )) @@ -100,7 +100,7 @@ (%i (frac-to-int numerator)) "/" (%i (frac-to-int denominator)))]) - (#R;Success [_ [_ (#;Frac actual)]]) + (#e;Success [_ [_ (#;Frac actual)]]) (f.= expected actual) _ @@ -113,7 +113,7 @@ (test "Can parse nat char syntax." (case (&;parse [default-cursor (format "#\"" (text;from-code expected) "\"")]) - (#R;Success [_ [_ (#;Nat actual)]]) + (#e;Success [_ [_ (#;Nat actual)]]) (n.= expected actual) _ @@ -162,10 +162,10 @@ (text;from-code z))] (case (&;parse [default-cursor (format "\"" bad-match "\"")]) - (#R;Error error) + (#e;Error error) true - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) false))) (test "Will accept valid multi-line text" (let [good-input (format (text;from-code x) "\n" @@ -177,36 +177,36 @@ (case (&;parse [(|> default-cursor (update@ #;column (n.+ (n.dec offset-size)))) (format "\"" good-input "\"")]) - (#R;Error error) + (#e;Error error) false - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed (code;text good-output))))) (test "Can handle comments." (case (&;parse [default-cursor (format comment (code;to-text sample))]) - (#R;Error error) + (#e;Error error) false - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." (and (case (&;parse [default-cursor (format "#(" "#(" unbalanced-comment ")#" (code;to-text sample))]) - (#R;Error error) + (#e;Error error) true - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) false) (case (&;parse [default-cursor (format "#(" unbalanced-comment ")#" ")#" (code;to-text sample))]) - (#R;Error error) + (#e;Error error) true - (#R;Success [_ parsed]) + (#e;Success [_ parsed]) false))) )) diff --git a/new-luxc/test/test/luxc/synthesizer/primitive.lux b/new-luxc/test/test/luxc/synthesizer/primitive.lux index 56d088abf..713e28cd1 100644 --- a/new-luxc/test/test/luxc/synthesizer/primitive.lux +++ b/new-luxc/test/test/luxc/synthesizer/primitive.lux @@ -4,7 +4,7 @@ (control [monad #+ do] pipe) (data text/format) - ["r" math/random "R/" Monad<Random>] + ["r" math/random] test) (luxc (lang ["la" analysis] ["ls" synthesis]) |