diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/lang/synthesis/case.lux | 10 | ||||
-rw-r--r-- | stdlib/test/test/lux/lang/synthesis/function.lux | 16 | ||||
-rw-r--r-- | stdlib/test/test/lux/lang/synthesis/primitive.lux | 4 | ||||
-rw-r--r-- | stdlib/test/test/lux/lang/synthesis/structure.lux | 9 |
4 files changed, 27 insertions, 12 deletions
diff --git a/stdlib/test/test/lux/lang/synthesis/case.lux b/stdlib/test/test/lux/lang/synthesis/case.lux index f2541ee0e..228ed2920 100644 --- a/stdlib/test/test/lux/lang/synthesis/case.lux +++ b/stdlib/test/test/lux/lang/synthesis/case.lux @@ -4,6 +4,7 @@ pipe) (data [error "error/" Functor<Error>]) (lang ["///." reference] + ["///." compiler] [".L" analysis #+ Branch Analysis] ["//" synthesis #+ Synthesis] (synthesis [".S" expression]) @@ -24,7 +25,8 @@ (list)]])]] (test "Dummy variables created to mask expressions get eliminated during synthesis." (|> maskA - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (error/map (//primitive.corresponds? maskedA)) (error.default false)))))) @@ -41,7 +43,8 @@ (list)]])]] (test "Can detect and reify simple 'let' expressions." (|> letA - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.branch/let [inputS registerS outputS]))) (and (n/= registerA registerS) (//primitive.corresponds? inputA inputS) @@ -68,7 +71,8 @@ (analysisL.control/case [inputA [elseB (list thenB)]]))]] (test "Can detect and reify simple 'if' expressions." (|> ifA - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.branch/if [inputS thenS elseS]))) (and (//primitive.corresponds? inputA inputS) (//primitive.corresponds? thenA thenS) diff --git a/stdlib/test/test/lux/lang/synthesis/function.lux b/stdlib/test/test/lux/lang/synthesis/function.lux index c0cfc5587..65a4825e3 100644 --- a/stdlib/test/test/lux/lang/synthesis/function.lux +++ b/stdlib/test/test/lux/lang/synthesis/function.lux @@ -12,6 +12,7 @@ (dictionary ["dict" unordered #+ Dict]) (set ["set" unordered]))) (lang ["///." reference #+ Variable "variable/" Equality<Variable>] + ["///." compiler] [".L" analysis #+ Analysis] ["//" synthesis #+ Arity Synthesis] (synthesis [".S" expression]) @@ -106,7 +107,8 @@ ($_ seq (test "Nested functions will get folded together." (|> function//constant - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.function/abstraction [environment arity output]))) (and (n/= arity//constant arity) (//primitive.corresponds? prediction//constant output)) @@ -115,7 +117,8 @@ (n/= +0 arity//constant)))) (test "Folded functions provide direct access to environment variables." (|> function//environment - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.function/abstraction [environment arity (#//.Reference (///reference.variable output))]))) (and (n/= arity//environment arity) (variable/= prediction//environment output)) @@ -124,7 +127,8 @@ false))) (test "Folded functions properly offset local variables." (|> function//local - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.function/abstraction [environment arity (#//.Reference (///reference.variable output))]))) (and (n/= arity//local arity) (variable/= prediction//local output)) @@ -142,7 +146,8 @@ ($_ seq (test "Can synthesize function application." (|> (analysisL.apply [funcA argsA]) - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (^ (#error.Success (//.function/apply [funcS argsS]))) (and (//primitive.corresponds? funcA funcS) (list.every? (product.uncurry //primitive.corresponds?) @@ -152,7 +157,8 @@ false))) (test "Function application on no arguments just synthesizes to the function itself." (|> (analysisL.apply [funcA (list)]) - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (#error.Success funcS) (//primitive.corresponds? funcA funcS) diff --git a/stdlib/test/test/lux/lang/synthesis/primitive.lux b/stdlib/test/test/lux/lang/synthesis/primitive.lux index ffe0eb795..1c8368204 100644 --- a/stdlib/test/test/lux/lang/synthesis/primitive.lux +++ b/stdlib/test/test/lux/lang/synthesis/primitive.lux @@ -7,6 +7,7 @@ text/format) [lang] (lang [".L" extension] + ["///." compiler] [".L" analysis #+ Analysis] ["//" synthesis #+ Synthesis] (synthesis [".S" expression])) @@ -74,7 +75,8 @@ (~~ (do-template [<desc> <analysis> <synthesis> <sample>] [(test (format "Can synthesize " <desc> ".") (|> (#analysisL.Primitive (<analysis> <sample>)) - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (#error.Success (#//.Primitive (<synthesis> value))) (is? <sample> value) diff --git a/stdlib/test/test/lux/lang/synthesis/structure.lux b/stdlib/test/test/lux/lang/synthesis/structure.lux index a8e298bf5..e61386044 100644 --- a/stdlib/test/test/lux/lang/synthesis/structure.lux +++ b/stdlib/test/test/lux/lang/synthesis/structure.lux @@ -7,7 +7,8 @@ [product] [error] (coll [list])) - (lang [".L" analysis] + (lang ["///." compiler] + [".L" analysis] ["//" synthesis #+ Synthesis] (synthesis [".S" expression]) [".L" extension]) @@ -24,7 +25,8 @@ ($_ seq (test "Can synthesize variants." (|> (analysisL.sum-analysis size tagA memberA) - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (#error.Success (#//.Structure (#//.Variant [leftsS right?S valueS]))) (let [tagS (if right?S (inc leftsS) leftsS)] (and (n/= tagA tagS) @@ -43,7 +45,8 @@ ($_ seq (test "Can synthesize tuple." (|> (analysisL.product-analysis membersA) - (//.run (expressionS.synthesizer extensionL.empty)) + (expressionS.synthesizer extensionL.empty) + (///compiler.run //.init) (case> (#error.Success (#//.Structure (#//.Tuple membersS))) (and (n/= size (list.size membersS)) (list.every? (product.uncurry //primitive.corresponds?) |