From 389b209b6f99364f1c16a495e6006c4d8f7defef Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Apr 2024 19:22:56 +0200 Subject: [PATCH] inline annotation support; Golden tests reorganized. --- lib/Language/PureScript/Backend/IR.hs | 136 +++++++++-------- lib/Language/PureScript/Backend/IR/DCE.hs | 10 +- lib/Language/PureScript/Backend/IR/Inliner.hs | 19 ++- lib/Language/PureScript/Backend/IR/Linker.hs | 12 +- lib/Language/PureScript/Backend/IR/Names.hs | 66 ++++++++ .../PureScript/Backend/IR/Optimizer.hs | 144 +++++++++++------- lib/Language/PureScript/Backend/IR/Query.hs | 8 +- lib/Language/PureScript/Backend/IR/Types.hs | 55 ++----- pslua.cabal | 18 ++- .../Backend/IR/{DCESpec.hs => DCE/Spec.hs} | 13 +- test/Language/PureScript/Backend/IR/Gen.hs | 1 + .../PureScript/Backend/IR/Inliner/Spec.hs | 33 ++++ .../{OptimizerSpec.hs => Optimizer/Spec.hs} | 19 ++- .../Backend/{IRSpec.hs => IR/Spec.hs} | 24 +-- .../IR/{TypesSpec.hs => Types/Spec.hs} | 11 +- .../Spec.hs} | 2 +- .../Lua/{GoldenSpec.hs => Golden/Spec.hs} | 2 +- .../{OptimizerSpec.hs => Optimizer/Spec.hs} | 2 +- .../Lua/{PrinterSpec.hs => Printer/Spec.hs} | 2 +- test/Main.hs | 18 ++- test/ps/golden/Golden/Annotations/M1.purs | 6 + test/ps/golden/Golden/Annotations/M2.purs | 6 + test/ps/golden/Golden/Beta/Test.purs | 8 + .../Golden/{TestBug1.purs => Bug1/Test.purs} | 2 +- .../Test.purs} | 4 +- .../{TestCurrying.purs => Currying/Test.purs} | 2 +- .../Test1.purs} | 2 +- .../Test2.purs} | 4 +- .../{TestForeign.lua => Foreign/Test.lua} | 0 test/ps/golden/Golden/Foreign/Test.purs | 3 + .../Test.purs} | 2 +- .../{TestInline.purs => Inline/Test.purs} | 2 +- .../Test.purs} | 2 +- .../{TestNewtype.purs => Newtype/Test.purs} | 2 +- .../Test1.purs} | 2 +- .../Test2.purs} | 4 +- .../Test.purs} | 2 +- .../Test.purs} | 2 +- .../Test.purs} | 2 +- .../Test.purs} | 2 +- .../{TestReexport.purs => Reexport/Test.purs} | 2 +- .../Test.lua} | 0 .../Test.purs} | 0 test/ps/golden/Golden/TestForeign.purs | 3 - .../Test.purs} | 2 +- .../{TestValues.purs => Values/Test.purs} | 2 +- .../output/Golden.Annotations.M1/corefn.json | 1 + .../ps/output/Golden.Annotations.M1/golden.ir | 14 ++ .../output/Golden.Annotations.M1/golden.lua | 1 + .../output/Golden.Annotations.M2/corefn.json | 1 + .../ps/output/Golden.Annotations.M2/golden.ir | 42 +++++ .../output/Golden.Annotations.M2/golden.lua | 9 ++ test/ps/output/Golden.Beta.Test/corefn.json | 1 + test/ps/output/Golden.Beta.Test/golden.ir | 13 ++ test/ps/output/Golden.Beta.Test/golden.lua | 1 + .../corefn.json | 2 +- .../golden.ir | 0 .../golden.lua | 0 .../Golden.CaseStatements.Test/corefn.json | 1 + .../golden.ir | 14 +- .../golden.lua | 14 +- .../corefn.json | 2 +- .../golden.ir | 8 +- .../golden.lua | 2 +- .../corefn.json | 2 +- .../golden.ir | 18 +-- .../golden.lua | 18 +-- .../Golden.DataDeclarations.Test2/corefn.json | 1 + .../golden.ir | 2 +- .../golden.lua | 2 +- .../corefn.json | 2 +- .../golden.ir | 2 +- .../golden.lua | 0 .../corefn.json | 2 +- .../golden.ir | 53 +++---- .../golden.lua | 8 +- .../corefn.json | 2 +- test/ps/output/Golden.Inline.Test/golden.ir | 2 + test/ps/output/Golden.Inline.Test/golden.lua | 1 + .../Golden.NameShadowing.Test/corefn.json | 1 + .../golden.ir | 32 +--- .../Golden.NameShadowing.Test/golden.lua | 19 +++ .../ps/output/Golden.Newtype.Test/corefn.json | 1 + .../golden.ir | 6 +- test/ps/output/Golden.Newtype.Test/golden.lua | 6 + .../Golden.PatternMatching.Test1/corefn.json | 1 + .../golden.ir | 28 ++-- .../golden.lua | 31 ++-- .../Golden.PatternMatching.Test2/corefn.json | 1 + .../golden.ir | 32 ++-- .../golden.lua | 37 ++--- .../Golden.RecDataDefs.Test/corefn.json | 1 + .../output/Golden.RecDataDefs.Test/golden.ir | 68 +++++++++ .../output/Golden.RecDataDefs.Test/golden.lua | 23 +++ .../corefn.json | 2 +- .../golden.ir | 6 +- .../Golden.RecordsAccess.Test/golden.lua | 8 + .../corefn.json | 2 +- .../golden.ir | 6 +- .../golden.lua | 6 +- .../corefn.json | 2 +- .../golden.ir | 24 +-- .../golden.lua | 6 +- .../corefn.json | 2 +- .../golden.ir | 0 .../golden.lua | 0 .../Golden.TestCaseStatements/corefn.json | 1 - .../Golden.TestDataDeclarations2/corefn.json | 1 - test/ps/output/Golden.TestInline/golden.ir | 9 -- test/ps/output/Golden.TestInline/golden.lua | 3 - .../Golden.TestNameShadowing/corefn.json | 1 - .../Golden.TestNameShadowing/golden.lua | 23 --- test/ps/output/Golden.TestNewtype/corefn.json | 1 - test/ps/output/Golden.TestNewtype/golden.lua | 6 - .../Golden.TestPatternMatching1/corefn.json | 1 - .../Golden.TestPatternMatching2/corefn.json | 1 - .../output/Golden.TestRecDataDefs/corefn.json | 1 - .../output/Golden.TestRecDataDefs/golden.ir | 68 --------- .../output/Golden.TestRecDataDefs/golden.lua | 19 --- .../Golden.TestRecordsAccess/golden.lua | 8 - .../Golden.TestReturnTableField/corefn.json | 2 +- .../Golden.TestReturnTableField/golden.ir | 2 +- .../output/Golden.TestUnbinding/corefn.json | 1 - .../ps/output/Golden.TestUnbinding/golden.lua | 9 -- .../output/Golden.Unbinding.Test/corefn.json | 1 + .../golden.ir | 8 +- .../output/Golden.Unbinding.Test/golden.lua | 9 ++ .../corefn.json | 2 +- .../golden.ir | 0 .../golden.lua | 0 130 files changed, 810 insertions(+), 622 deletions(-) create mode 100644 lib/Language/PureScript/Backend/IR/Names.hs rename test/Language/PureScript/Backend/IR/{DCESpec.hs => DCE/Spec.hs} (96%) create mode 100644 test/Language/PureScript/Backend/IR/Inliner/Spec.hs rename test/Language/PureScript/Backend/IR/{OptimizerSpec.hs => Optimizer/Spec.hs} (94%) rename test/Language/PureScript/Backend/{IRSpec.hs => IR/Spec.hs} (96%) rename test/Language/PureScript/Backend/IR/{TypesSpec.hs => Types/Spec.hs} (96%) rename test/Language/PureScript/Backend/Lua/{DeadCodeEliminatorSpec.hs => DeadCodeEliminator/Spec.hs} (99%) rename test/Language/PureScript/Backend/Lua/{GoldenSpec.hs => Golden/Spec.hs} (99%) rename test/Language/PureScript/Backend/Lua/{OptimizerSpec.hs => Optimizer/Spec.hs} (97%) rename test/Language/PureScript/Backend/Lua/{PrinterSpec.hs => Printer/Spec.hs} (99%) create mode 100644 test/ps/golden/Golden/Annotations/M1.purs create mode 100644 test/ps/golden/Golden/Annotations/M2.purs create mode 100644 test/ps/golden/Golden/Beta/Test.purs rename test/ps/golden/Golden/{TestBug1.purs => Bug1/Test.purs} (72%) rename test/ps/golden/Golden/{TestCaseStatements.purs => CaseStatements/Test.purs} (94%) rename test/ps/golden/Golden/{TestCurrying.purs => Currying/Test.purs} (78%) rename test/ps/golden/Golden/{TestDataDeclarations1.purs => DataDeclarations/Test1.purs} (84%) rename test/ps/golden/Golden/{TestDataDeclarations2.purs => DataDeclarations/Test2.purs} (59%) rename test/ps/golden/Golden/{TestForeign.lua => Foreign/Test.lua} (100%) create mode 100644 test/ps/golden/Golden/Foreign/Test.purs rename test/ps/golden/Golden/{TestHelloPrelude.purs => HelloPrelude/Test.purs} (65%) rename test/ps/golden/Golden/{TestInline.purs => Inline/Test.purs} (80%) rename test/ps/golden/Golden/{TestNameShadowing.purs => NameShadowing/Test.purs} (80%) rename test/ps/golden/Golden/{TestNewtype.purs => Newtype/Test.purs} (75%) rename test/ps/golden/Golden/{TestPatternMatching1.purs => PatternMatching/Test1.purs} (87%) rename test/ps/golden/Golden/{TestPatternMatching2.purs => PatternMatching/Test2.purs} (77%) rename test/ps/golden/Golden/{TestRecDataDefs.purs => RecDataDefs/Test.purs} (73%) rename test/ps/golden/Golden/{TestRecordsAccess.purs => RecordsAccess/Test.purs} (84%) rename test/ps/golden/Golden/{TestRecordsUpdate.purs => RecordsUpdate/Test.purs} (90%) rename test/ps/golden/Golden/{TestRecursiveBindings.purs => RecursiveBindings/Test.purs} (96%) rename test/ps/golden/Golden/{TestReexport.purs => Reexport/Test.purs} (73%) rename test/ps/golden/Golden/{TestReturnTableField.lua => ReturnTableField/Test.lua} (100%) rename test/ps/golden/Golden/{TestReturnTableField.purs => ReturnTableField/Test.purs} (100%) delete mode 100644 test/ps/golden/Golden/TestForeign.purs rename test/ps/golden/Golden/{TestUnbinding.purs => Unbinding/Test.purs} (52%) rename test/ps/golden/Golden/{TestValues.purs => Values/Test.purs} (85%) create mode 100644 test/ps/output/Golden.Annotations.M1/corefn.json create mode 100644 test/ps/output/Golden.Annotations.M1/golden.ir create mode 100644 test/ps/output/Golden.Annotations.M1/golden.lua create mode 100644 test/ps/output/Golden.Annotations.M2/corefn.json create mode 100644 test/ps/output/Golden.Annotations.M2/golden.ir create mode 100644 test/ps/output/Golden.Annotations.M2/golden.lua create mode 100644 test/ps/output/Golden.Beta.Test/corefn.json create mode 100644 test/ps/output/Golden.Beta.Test/golden.ir create mode 100644 test/ps/output/Golden.Beta.Test/golden.lua rename test/ps/output/{Golden.TestBug1 => Golden.Bug1.Test}/corefn.json (94%) rename test/ps/output/{Golden.TestBug1 => Golden.Bug1.Test}/golden.ir (100%) rename test/ps/output/{Golden.TestBug1 => Golden.Bug1.Test}/golden.lua (100%) create mode 100644 test/ps/output/Golden.CaseStatements.Test/corefn.json rename test/ps/output/{Golden.TestCaseStatements => Golden.CaseStatements.Test}/golden.ir (85%) rename test/ps/output/{Golden.TestCaseStatements => Golden.CaseStatements.Test}/golden.lua (68%) rename test/ps/output/{Golden.TestCurrying => Golden.Currying.Test}/corefn.json (92%) rename test/ps/output/{Golden.TestCurrying => Golden.Currying.Test}/golden.ir (65%) rename test/ps/output/{Golden.TestCurrying => Golden.Currying.Test}/golden.lua (70%) rename test/ps/output/{Golden.TestDataDeclarations1 => Golden.DataDeclarations.Test1}/corefn.json (93%) rename test/ps/output/{Golden.TestDataDeclarations1 => Golden.DataDeclarations.Test1}/golden.ir (71%) rename test/ps/output/{Golden.TestDataDeclarations1 => Golden.DataDeclarations.Test1}/golden.lua (50%) create mode 100644 test/ps/output/Golden.DataDeclarations.Test2/corefn.json rename test/ps/output/{Golden.TestDataDeclarations2 => Golden.DataDeclarations.Test2}/golden.ir (86%) rename test/ps/output/{Golden.TestDataDeclarations2 => Golden.DataDeclarations.Test2}/golden.lua (59%) rename test/ps/output/{Golden.TestForeign => Golden.Foreign.Test}/corefn.json (57%) rename test/ps/output/{Golden.TestForeign => Golden.Foreign.Test}/golden.ir (72%) rename test/ps/output/{Golden.TestForeign => Golden.Foreign.Test}/golden.lua (100%) rename test/ps/output/{Golden.TestHelloPrelude => Golden.HelloPrelude.Test}/corefn.json (87%) rename test/ps/output/{Golden.TestHelloPrelude => Golden.HelloPrelude.Test}/golden.ir (84%) rename test/ps/output/{Golden.TestHelloPrelude => Golden.HelloPrelude.Test}/golden.lua (93%) rename test/ps/output/{Golden.TestInline => Golden.Inline.Test}/corefn.json (90%) create mode 100644 test/ps/output/Golden.Inline.Test/golden.ir create mode 100644 test/ps/output/Golden.Inline.Test/golden.lua create mode 100644 test/ps/output/Golden.NameShadowing.Test/corefn.json rename test/ps/output/{Golden.TestNameShadowing => Golden.NameShadowing.Test}/golden.ir (60%) create mode 100644 test/ps/output/Golden.NameShadowing.Test/golden.lua create mode 100644 test/ps/output/Golden.Newtype.Test/corefn.json rename test/ps/output/{Golden.TestNewtype => Golden.Newtype.Test}/golden.ir (56%) create mode 100644 test/ps/output/Golden.Newtype.Test/golden.lua create mode 100644 test/ps/output/Golden.PatternMatching.Test1/corefn.json rename test/ps/output/{Golden.TestPatternMatching1 => Golden.PatternMatching.Test1}/golden.ir (82%) rename test/ps/output/{Golden.TestPatternMatching1 => Golden.PatternMatching.Test1}/golden.lua (55%) create mode 100644 test/ps/output/Golden.PatternMatching.Test2/corefn.json rename test/ps/output/{Golden.TestPatternMatching2 => Golden.PatternMatching.Test2}/golden.ir (76%) rename test/ps/output/{Golden.TestPatternMatching2 => Golden.PatternMatching.Test2}/golden.lua (51%) create mode 100644 test/ps/output/Golden.RecDataDefs.Test/corefn.json create mode 100644 test/ps/output/Golden.RecDataDefs.Test/golden.ir create mode 100644 test/ps/output/Golden.RecDataDefs.Test/golden.lua rename test/ps/output/{Golden.TestRecordsAccess => Golden.RecordsAccess.Test}/corefn.json (85%) rename test/ps/output/{Golden.TestRecordsAccess => Golden.RecordsAccess.Test}/golden.ir (77%) create mode 100644 test/ps/output/Golden.RecordsAccess.Test/golden.lua rename test/ps/output/{Golden.TestRecordsUpdate => Golden.RecordsUpdate.Test}/corefn.json (79%) rename test/ps/output/{Golden.TestRecordsUpdate => Golden.RecordsUpdate.Test}/golden.ir (85%) rename test/ps/output/{Golden.TestRecordsUpdate => Golden.RecordsUpdate.Test}/golden.lua (78%) rename test/ps/output/{Golden.TestRecursiveBindings => Golden.RecursiveBindings.Test}/corefn.json (98%) rename test/ps/output/{Golden.TestRecursiveBindings => Golden.RecursiveBindings.Test}/golden.ir (86%) rename test/ps/output/{Golden.TestRecursiveBindings => Golden.RecursiveBindings.Test}/golden.lua (90%) rename test/ps/output/{Golden.TestReexport => Golden.Reexport.Test}/corefn.json (84%) rename test/ps/output/{Golden.TestReexport => Golden.Reexport.Test}/golden.ir (100%) rename test/ps/output/{Golden.TestReexport => Golden.Reexport.Test}/golden.lua (100%) delete mode 100644 test/ps/output/Golden.TestCaseStatements/corefn.json delete mode 100644 test/ps/output/Golden.TestDataDeclarations2/corefn.json delete mode 100644 test/ps/output/Golden.TestInline/golden.ir delete mode 100644 test/ps/output/Golden.TestInline/golden.lua delete mode 100644 test/ps/output/Golden.TestNameShadowing/corefn.json delete mode 100644 test/ps/output/Golden.TestNameShadowing/golden.lua delete mode 100644 test/ps/output/Golden.TestNewtype/corefn.json delete mode 100644 test/ps/output/Golden.TestNewtype/golden.lua delete mode 100644 test/ps/output/Golden.TestPatternMatching1/corefn.json delete mode 100644 test/ps/output/Golden.TestPatternMatching2/corefn.json delete mode 100644 test/ps/output/Golden.TestRecDataDefs/corefn.json delete mode 100644 test/ps/output/Golden.TestRecDataDefs/golden.ir delete mode 100644 test/ps/output/Golden.TestRecDataDefs/golden.lua delete mode 100644 test/ps/output/Golden.TestRecordsAccess/golden.lua delete mode 100644 test/ps/output/Golden.TestUnbinding/corefn.json delete mode 100644 test/ps/output/Golden.TestUnbinding/golden.lua create mode 100644 test/ps/output/Golden.Unbinding.Test/corefn.json rename test/ps/output/{Golden.TestUnbinding => Golden.Unbinding.Test}/golden.ir (60%) create mode 100644 test/ps/output/Golden.Unbinding.Test/golden.lua rename test/ps/output/{Golden.TestValues => Golden.Values.Test}/corefn.json (50%) rename test/ps/output/{Golden.TestValues => Golden.Values.Test}/golden.ir (100%) rename test/ps/output/{Golden.TestValues => Golden.Values.Test}/golden.lua (100%) diff --git a/lib/Language/PureScript/Backend/IR.hs b/lib/Language/PureScript/Backend/IR.hs index ca6623c..bf7996c 100644 --- a/lib/Language/PureScript/Backend/IR.hs +++ b/lib/Language/PureScript/Backend/IR.hs @@ -1,6 +1,7 @@ module Language.PureScript.Backend.IR ( module Language.PureScript.Backend.IR , module Language.PureScript.Backend.IR.Types + , module Language.PureScript.Backend.IR.Names ) where import Control.Monad.Error.Class (MonadError (throwError)) @@ -14,11 +15,11 @@ import Data.Text qualified as Text import Data.Traversable (for) import Language.PureScript.Backend.IR.Inliner (Annotation) import Language.PureScript.Backend.IR.Inliner qualified as Inliner +import Language.PureScript.Backend.IR.Names import Language.PureScript.Backend.IR.Types import Language.PureScript.Comments (Comment (..)) import Language.PureScript.CoreFn qualified as Cfn import Language.PureScript.CoreFn.Laziness (applyLazinessTransform) -import Language.PureScript.Names (ModuleName (..), runModuleName) import Language.PureScript.Names qualified as Names import Language.PureScript.Names qualified as PS import Language.PureScript.PSString @@ -35,7 +36,7 @@ import Prelude hiding (identity, show) data Context = Context { annotations - ∷ [Annotation] + ∷ Map Name Annotation , contextModule ∷ Cfn.Module Cfn.Ann , contextDataTypes @@ -87,7 +88,7 @@ mkModule cfnModule contextDataTypes = do , needsRuntimeLazy = Any False } do - moduleBindings ← mkDecls + moduleBindings ← mkBindings moduleImports ← mkImports moduleExports ← mkExports moduleReExports ← mkReExports @@ -103,20 +104,20 @@ mkModule cfnModule contextDataTypes = do , moduleForeigns } -parseAnnotations ∷ Cfn.Module Cfn.Ann → Either CoreFnError [Annotation] +parseAnnotations ∷ Cfn.Module Cfn.Ann → Either CoreFnError (Map Name Annotation) parseAnnotations currentModule = Cfn.moduleComments currentModule & foldMapM \case - LineComment line → pure <$> parseAnnotationLine line - BlockComment block → traverse parseAnnotationLine (lines block) - & fmap catMaybes + LineComment line → pure <$> parsePragmaLine line + BlockComment block → traverse parsePragmaLine (lines block) + & fmap (Map.fromList . catMaybes) where - parseAnnotationLine ∷ Text → Either CoreFnError (Maybe Annotation) - parseAnnotationLine (Text.strip → ln) = do - let parser = optional (Inliner.annotationParser <* Megaparsec.eof) - first - (CoreFnError (Cfn.moduleName currentModule) . AnnotationParsingError) - (Megaparsec.parse parser (Cfn.modulePath currentModule) ln) + parsePragmaLine ∷ Text → Either CoreFnError (Maybe Inliner.Pragma) + parsePragmaLine ln = do + let parser = optional (Inliner.pragmaParser <* Megaparsec.eof) + Megaparsec.parse parser (Cfn.modulePath currentModule) (Text.strip ln) + & first + (CoreFnError (Cfn.moduleName currentModule) . AnnotationParsingError) mkImports ∷ RepM [ModuleName] mkImports = do @@ -169,15 +170,19 @@ mkQualified f (PS.Qualified by a) = identToName ∷ PS.Ident → Name identToName = Name . PS.runIdent -mkDecls ∷ RepM [Grouping (Ann, Name, Exp)] -mkDecls = do - psDecls ← gets $ contextModule >>> Cfn.moduleBindings - traverse mkGrouping psDecls +mkBindings ∷ RepM [Binding] +mkBindings = do + psBindings ← gets $ contextModule >>> Cfn.moduleBindings + traverse mkBinding psBindings -mkGrouping ∷ Cfn.Bind Cfn.Ann → RepM (Grouping (Ann, Name, Exp)) -mkGrouping = \case - Cfn.NonRec _ann ident cfnExpr → - Standalone . (noAnn,identToName ident,) <$> makeExp cfnExpr +mkBinding ∷ Cfn.Bind Cfn.Ann → RepM Binding +mkBinding = \case + Cfn.NonRec _ann ident cfnExpr → do + let name = identToName ident + ann ← gets $ annotations >>> Map.lookup name + expr ← makeExprAnnotated ann cfnExpr + + pure $ Standalone (noAnn, name, expr) Cfn.Rec bindingGroup → do modname ← gets $ contextModule >>> Cfn.moduleName bindings ← writer $ applyLazinessTransform modname bindingGroup @@ -185,64 +190,69 @@ mkGrouping = \case Nothing → throwContextualError EmptyBindingGroup Just bs → RecursiveGroup <$> for bs \((_ann, ident), expr) → - (noAnn,identToName ident,) <$> makeExp expr + (noAnn,identToName ident,) <$> makeExpr expr + +makeExpr ∷ CfnExp → RepM Exp +makeExpr = makeExprAnnotated Nothing -makeExp ∷ CfnExp → RepM Exp -makeExp cfnExpr = +makeExprAnnotated ∷ Ann → CfnExp → RepM Exp +makeExprAnnotated ann cfnExpr = case cfnExpr of Cfn.Literal _ann literal → - mkLiteral literal - Cfn.Constructor ann tyName ctorName ids → - mkConstructor ann tyName ctorName ids + mkLiteral ann literal + Cfn.Constructor cfnAnn tyName ctorName ids → + mkConstructor cfnAnn ann tyName ctorName ids Cfn.Accessor _ann str expr → - mkAccessor str expr + mkAccessor ann str expr Cfn.ObjectUpdate _ann expr patches → mkObjectUpdate expr patches Cfn.Abs _ann ident expr → - mkAbstraction ident expr + mkAbstraction ann ident expr Cfn.App _ann abstr arg → mkApplication abstr arg Cfn.Var _ann qualifiedIdent → mkRef qualifiedIdent Cfn.Case _ann exprs alternatives → case NE.nonEmpty alternatives of - Just as → mkCase exprs as + Just as → mkCase ann exprs as Nothing → throwContextualError $ EmptyCase cfnExpr - Cfn.Let _ann binds exprs → mkLet binds exprs + Cfn.Let _ann binds exprs → + mkLet ann binds exprs -mkLiteral ∷ Cfn.Literal CfnExp → RepM Exp -mkLiteral = \case +mkLiteral ∷ Ann → Cfn.Literal CfnExp → RepM Exp +mkLiteral ann = \case Cfn.NumericLiteral (Left i) → - pure $ literalInt i + pure $ LiteralInt ann i Cfn.NumericLiteral (Right d) → - pure $ literalFloat d + pure $ LiteralFloat ann d Cfn.StringLiteral s → - pure $ literalString $ decodeStringEscaping s + pure $ LiteralString ann $ decodeStringEscaping s Cfn.CharLiteral c → - pure $ literalChar c + pure $ LiteralChar ann c Cfn.BooleanLiteral b → - pure $ literalBool b + pure $ LiteralBool ann b Cfn.ArrayLiteral exprs → - literalArray <$> traverse makeExp exprs + LiteralArray ann <$> traverse makeExpr exprs Cfn.ObjectLiteral kvs → - literalObject <$> traverse (bitraverse mkPropName makeExp) kvs + LiteralObject ann <$> traverse (bitraverse mkPropName makeExpr) kvs mkConstructor ∷ Cfn.Ann + → Ann → PS.ProperName 'PS.TypeName → PS.ProperName 'PS.ConstructorName → [PS.Ident] → RepM Exp -mkConstructor ann properTyName properCtorName fields = do +mkConstructor cfnAnn ann properTyName properCtorName fields = do let tyName = mkTyName properTyName contextModuleName ← gets (Cfn.moduleName . contextModule) algTy ← algebraicTy contextModuleName tyName pure - if isNewtype ann + if isNewtype cfnAnn then identity else Ctor - noAnn + ann algTy contextModuleName tyName @@ -263,21 +273,21 @@ mkPropName str = case decodeString str of Left err → throwContextualError $ UnicodeDecodeError err Right decodedString → pure $ PropName decodedString -mkAccessor ∷ PSString → CfnExp → RepM Exp -mkAccessor prop cfnExpr = do +mkAccessor ∷ Ann → PSString → CfnExp → RepM Exp +mkAccessor ann prop cfnExpr = do propName ← mkPropName prop - makeExp cfnExpr <&> \expr → ObjectProp noAnn expr propName + makeExprAnnotated ann cfnExpr <&> \expr → ObjectProp noAnn expr propName mkObjectUpdate ∷ CfnExp → [(PSString, CfnExp)] → RepM Exp mkObjectUpdate cfnExp props = do - expr ← makeExp cfnExp - patch ← traverse (bitraverse mkPropName makeExp) props + expr ← makeExpr cfnExp + patch ← traverse (bitraverse mkPropName makeExpr) props case NE.nonEmpty patch of Nothing → throwContextualError EmptyObjectUpdate Just ps → pure $ ObjectUpdate noAnn expr ps -mkAbstraction ∷ PS.Ident → CfnExp → RepM Exp -mkAbstraction i e = abstraction param <$> makeExp e +mkAbstraction ∷ Ann → PS.Ident → CfnExp → RepM Exp +mkAbstraction ann i e = Abs ann param <$> makeExpr e where param ∷ Parameter Ann = case PS.runIdent i of @@ -287,8 +297,8 @@ mkAbstraction i e = abstraction param <$> makeExp e mkApplication ∷ CfnExp → CfnExp → RepM Exp mkApplication e1 e2 = if isNewtype (Cfn.extractAnn e1) - then makeExp e2 - else application <$> makeExp e1 <*> makeExp e2 + then makeExpr e2 + else application <$> makeExpr e1 <*> makeExpr e2 mkQualifiedIdent ∷ PS.Qualified PS.Ident → RepM (Qualified Name) mkQualifiedIdent (PS.Qualified by ident) = @@ -303,27 +313,27 @@ mkQualifiedIdent (PS.Qualified by ident) = mkRef ∷ PS.Qualified PS.Ident → RepM Exp mkRef = (\n → Ref noAnn n 0) <<$>> mkQualifiedIdent -mkLet ∷ [Cfn.Bind Cfn.Ann] → CfnExp → RepM Exp -mkLet binds expr = do - groupings ∷ NonEmpty (Grouping (Ann, Name, Exp)) ← +mkLet ∷ Ann → [Cfn.Bind Cfn.Ann] → CfnExp → RepM Exp +mkLet ann binds expr = do + groupings ∷ NonEmpty Binding ← NE.nonEmpty binds - & maybe (throwContextualError LetWithoutBinds) (traverse mkGrouping) - lets groupings <$> makeExp expr + & maybe (throwContextualError LetWithoutBinds) (traverse mkBinding) + Let ann groupings <$> makeExpr expr -------------------------------------------------------------------------------- -- Case statements are compiled to a decision trees (nested if/else's) --------- -- The algorithm is based on this document: ------------------------------------ -- https://julesjacobs.com/notes/patternmatching/patternmatching.pdf ----------- -mkCase ∷ [CfnExp] → NonEmpty (Cfn.CaseAlternative Cfn.Ann) → RepM Exp -mkCase cfnExpressions alternatives = do - expressions ← traverse makeExp cfnExpressions +mkCase ∷ Ann -> [CfnExp] → NonEmpty (Cfn.CaseAlternative Cfn.Ann) → RepM Exp +mkCase ann cfnExpressions alternatives = do + expressions ← traverse makeExpr cfnExpressions -- Before making clauses, we need to prepare bindings -- such that instead of repeating the same expression multiple times, -- we can bind it to a name once and then repeat references. (references, bindings) ← prepareBindings expressions clauses ← traverse (alternativeToClauses references) alternatives - let addHeader = maybe id lets (NE.nonEmpty bindings) + let addHeader = maybe id (Let ann) (NE.nonEmpty bindings) addHeader <$> mkCaseClauses (NE.toList clauses) -- Either an expression to inline, or a named expression reference. @@ -649,8 +659,8 @@ alternativeToClauses clauseResult ← bitraverse - (traverse (bitraverse makeExp makeExp)) - makeExp + (traverse (bitraverse makeExpr makeExpr)) + makeExpr caseAlternativeResult pure diff --git a/lib/Language/PureScript/Backend/IR/DCE.hs b/lib/Language/PureScript/Backend/IR/DCE.hs index 29e4743..cf2f092 100644 --- a/lib/Language/PureScript/Backend/IR/DCE.hs +++ b/lib/Language/PureScript/Backend/IR/DCE.hs @@ -7,15 +7,18 @@ import Data.List.NonEmpty qualified as NE import Data.Map qualified as Map import Data.Set qualified as Set import Language.PureScript.Backend.IR.Linker (UberModule (..)) +import Language.PureScript.Backend.IR.Names + ( ModuleName + , Name + , QName (..) + , Qualified (..) + ) import Language.PureScript.Backend.IR.Types ( Ann , Exp , Grouping (..) , Index - , Name , Parameter (..) - , QName (..) - , Qualified (..) , RawExp (..) , RewriteMod (..) , Rewritten (..) @@ -24,7 +27,6 @@ import Language.PureScript.Backend.IR.Types , listGrouping , rewriteExpTopDown ) -import Language.PureScript.Names (ModuleName) data EntryPoint = EntryPoint ModuleName [Name] deriving stock (Show) diff --git a/lib/Language/PureScript/Backend/IR/Inliner.hs b/lib/Language/PureScript/Backend/IR/Inliner.hs index e33a94b..82a1dbf 100644 --- a/lib/Language/PureScript/Backend/IR/Inliner.hs +++ b/lib/Language/PureScript/Backend/IR/Inliner.hs @@ -1,9 +1,13 @@ module Language.PureScript.Backend.IR.Inliner where +import Control.Monad.Combinators (choice) +import Language.PureScript.Backend.IR.Names (Name, nameParser) import Text.Megaparsec qualified as Megaparsec import Text.Megaparsec.Char qualified as MC import Text.Megaparsec.Char.Lexer qualified as ML +type Pragma = (Name, Annotation) + data Annotation = Annotation InlineScope InlineRecipe deriving stock (Show, Eq, Ord) @@ -15,13 +19,17 @@ data InlineRecipe = Default | Always | Never type Parser = Megaparsec.Parsec Void Text +pragmaParser ∷ Parser Pragma +pragmaParser = do + symbol "@inline" + (,) <$> (nameParser <* sc) <*> annotationParser + annotationParser ∷ Parser Annotation -annotationParser = - symbol "@inline" *> (Annotation <$> scopeParser <*> recipeParser) +annotationParser = Annotation <$> scopeParser <*> recipeParser recipeParser ∷ Parser InlineRecipe recipeParser = - asum + choice [ Default <$ symbol "default" , Always <$ symbol "always" , Never <$ symbol "never" @@ -31,4 +39,7 @@ scopeParser ∷ Parser InlineScope scopeParser = maybe InModule (const Global) <$> optional (symbol "export") symbol ∷ Text → Parser () -symbol = void . ML.symbol (ML.space (MC.hspace1 @_ @Text) empty empty) +symbol = void . ML.symbol sc + +sc ∷ Parser () +sc = ML.space (MC.hspace1 @_ @Text) empty empty diff --git a/lib/Language/PureScript/Backend/IR/Linker.hs b/lib/Language/PureScript/Backend/IR/Linker.hs index b650bb6..6dab44e 100644 --- a/lib/Language/PureScript/Backend/IR/Linker.hs +++ b/lib/Language/PureScript/Backend/IR/Linker.hs @@ -4,6 +4,13 @@ module Language.PureScript.Backend.IR.Linker where import Data.Graph (graphFromEdges', reverseTopSort) import Data.Map qualified as Map +import Language.PureScript.Backend.IR.Names + ( ModuleName + , Name (..) + , PropName (PropName) + , QName (QName) + , Qualified (Imported, Local) + ) import Language.PureScript.Backend.IR.Types ( Ann , Binding @@ -11,18 +18,13 @@ import Language.PureScript.Backend.IR.Types , Grouping (..) , Index , Module (..) - , Name (..) , Parameter (ParamNamed, ParamUnused) - , PropName (..) - , QName (QName) - , Qualified (Imported, Local) , RawExp (..) , bindingNames , noAnn , objectProp , refImported ) -import Language.PureScript.Names (ModuleName) -------------------------------------------------------------------------------- -- Data ------------------------------------------------------------------------ diff --git a/lib/Language/PureScript/Backend/IR/Names.hs b/lib/Language/PureScript/Backend/IR/Names.hs new file mode 100644 index 0000000..68672f3 --- /dev/null +++ b/lib/Language/PureScript/Backend/IR/Names.hs @@ -0,0 +1,66 @@ +module Language.PureScript.Backend.IR.Names + ( module Reexport + , Name (..) + , nameParser + , QName (..) + , printQName + , TyName (..) + , CtorName (..) + , FieldName (..) + , PropName (..) + , Qualified (..) + , qualifiedQName + ) where + +import Data.Char (isAlphaNum) +import Language.PureScript.Names as Reexport + ( ModuleName (..) + , moduleNameFromString + , runModuleName + ) +import Quiet (Quiet (..)) +import Text.Megaparsec qualified as Megaparsec +import Prelude hiding (show) + +newtype Name = Name {nameToText ∷ Text} + deriving newtype (Eq, Ord) + deriving stock (Generic) + deriving (Show) via (Quiet Name) + +nameParser ∷ Megaparsec.Parsec Void Text Name +nameParser = Name <$> Megaparsec.takeWhile1P (Just "name char") isAlphaNum + +data QName = QName {qnameModuleName ∷ ModuleName, qnameName ∷ Name} + deriving stock (Eq, Ord, Show) + +printQName ∷ QName → Text +printQName QName {..} = + runModuleName qnameModuleName <> "∷" <> nameToText qnameName + +newtype TyName = TyName {renderTyName ∷ Text} + deriving newtype (Eq, Ord) + deriving stock (Generic) + deriving (Show) via (Quiet TyName) + +newtype CtorName = CtorName {renderCtorName ∷ Text} + deriving newtype (Eq, Ord) + deriving stock (Generic) + deriving (Show) via (Quiet CtorName) + +-- TODO: is it used at all? +newtype FieldName = FieldName {renderFieldName ∷ Text} + deriving newtype (Eq, Ord) + deriving stock (Generic) + deriving (Show) via (Quiet FieldName) + +newtype PropName = PropName {renderPropName ∷ Text} + deriving newtype (Eq, Ord) + deriving stock (Generic) + deriving (Show) via (Quiet PropName) + +data Qualified a = Local a | Imported ModuleName a + deriving stock (Show, Eq, Ord, Functor) + +qualifiedQName ∷ QName → Qualified Name +qualifiedQName QName {qnameModuleName, qnameName} = + Imported qnameModuleName qnameName diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index 546d7b5..ef058c2 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -4,15 +4,24 @@ import Data.List.NonEmpty qualified as NE import Data.Map qualified as Map import Data.Set qualified as Set import Language.PureScript.Backend.IR.DCE qualified as DCE +import Language.PureScript.Backend.IR.Inliner + ( Annotation (..) + , InlineRecipe (..) + , InlineScope (InModule) + ) import Language.PureScript.Backend.IR.Linker (UberModule (..)) +import Language.PureScript.Backend.IR.Names + ( Name (..) + , QName + , Qualified (Local) + , qualifiedQName + ) import Language.PureScript.Backend.IR.Query (collectBoundNames) import Language.PureScript.Backend.IR.Types ( Ann , Exp , Grouping (..) - , Name (..) - , QName (..) - , Qualified (..) + , Parameter (..) , RawExp (..) , RewriteMod (..) , RewriteRule @@ -20,14 +29,14 @@ import Language.PureScript.Backend.IR.Types , bindingExprs , countFreeRef , countFreeRefs + , getAnn , isNonRecursiveLiteral , literalBool - , qualifiedQName , rewriteExpTopDown , substitute , thenRewrite + , unIndex ) -import Language.PureScript.Backend.IR.Types qualified as IR optimizedUberModule ∷ UberModule → UberModule optimizedUberModule = @@ -47,53 +56,53 @@ renameShadowedNamesInExpr scope = go where go ∷ Exp → Exp go = \case - IR.LiteralInt ann i → - IR.LiteralInt ann i - IR.LiteralFloat ann f → - IR.LiteralFloat ann f - IR.LiteralString ann s → - IR.LiteralString ann s - IR.LiteralChar ann c → - IR.LiteralChar ann c - IR.LiteralBool ann b → - IR.LiteralBool ann b - IR.LiteralArray ann as → - IR.LiteralArray ann (go <$> as) - IR.LiteralObject ann ps → - IR.LiteralObject ann (go <<$>> ps) - IR.ReflectCtor ann a → - IR.ReflectCtor ann (go a) - IR.Eq ann a b → - IR.Eq ann (go a) (go b) - IR.DataArgumentByIndex ann index a → - IR.DataArgumentByIndex ann index (go a) - IR.ArrayLength ann a → - IR.ArrayLength ann (go a) - IR.ArrayIndex ann a index → - IR.ArrayIndex ann (go a) index - IR.ObjectProp ann a prop → - IR.ObjectProp ann (go a) prop - IR.ObjectUpdate ann a ps → - IR.ObjectUpdate ann (go a) (go <<$>> ps) - IR.Abs ann param body → - IR.Abs ann param' (renameShadowedNamesInExpr scope' body) + LiteralInt ann i → + LiteralInt ann i + LiteralFloat ann f → + LiteralFloat ann f + LiteralString ann s → + LiteralString ann s + LiteralChar ann c → + LiteralChar ann c + LiteralBool ann b → + LiteralBool ann b + LiteralArray ann as → + LiteralArray ann (go <$> as) + LiteralObject ann ps → + LiteralObject ann (go <<$>> ps) + ReflectCtor ann a → + ReflectCtor ann (go a) + Eq ann a b → + Eq ann (go a) (go b) + DataArgumentByIndex ann index a → + DataArgumentByIndex ann index (go a) + ArrayLength ann a → + ArrayLength ann (go a) + ArrayIndex ann a index → + ArrayIndex ann (go a) index + ObjectProp ann a prop → + ObjectProp ann (go a) prop + ObjectUpdate ann a ps → + ObjectUpdate ann (go a) (go <<$>> ps) + Abs ann param body → + Abs ann param' (renameShadowedNamesInExpr scope' body) where (param', scope') = case param of - IR.ParamUnused _ann → (param, scope) - IR.ParamNamed paramAnn name → - first (IR.ParamNamed paramAnn) (withScopedName body scope name) - IR.App ann a b → - IR.App ann (go a) (go b) - IR.Ref ann qname index → + ParamUnused _ann → (param, scope) + ParamNamed paramAnn name → + first (ParamNamed paramAnn) (withScopedName body scope name) + App ann a b → + App ann (go a) (go b) + Ref ann qname index → case qname of - IR.Local lname + Local lname | Just renames ← Map.lookup lname scope - , Just rename ← renames !!? fromIntegral (IR.unIndex index) → - IR.Ref ann (IR.Local rename) 0 - _ → IR.Ref ann qname index - IR.Let ann binds body → - IR.Let ann (NE.fromList (reverse binds')) body' + , Just rename ← renames !!? fromIntegral (unIndex index) → + Ref ann (Local rename) 0 + _ → Ref ann qname index + Let ann binds body → + Let ann (NE.fromList (reverse binds')) body' where scope' ∷ RenamesInScope binds' ∷ [Grouping (Ann, Name, Exp)] @@ -119,14 +128,14 @@ renameShadowedNamesInExpr scope = go let expr' = renameShadowedNamesInExpr sc' expr in (sc'', (ann', name', expr') : recBinds) body' = renameShadowedNamesInExpr scope' body - IR.IfThenElse ann i t e → - IR.IfThenElse ann (go i) (go t) (go e) - IR.Ctor ann aty mn ty ctr fs → - IR.Ctor ann aty mn ty ctr fs - IR.Exception ann m → - IR.Exception ann m - IR.ForeignImport ann m p ns → - IR.ForeignImport ann m p ns + IfThenElse ann i t e → + IfThenElse ann (go i) (go t) (go e) + Ctor ann aty mn ty ctr fs → + Ctor ann aty mn ty ctr fs + Exception ann m → + Exception ann m + ForeignImport ann m p ns → + ForeignImport ann m p ns where withScopedName ∷ Exp → Map Name [Name] → Name → (Name, Map Name [Name]) withScopedName e sc name = @@ -214,10 +223,12 @@ substituteInExports ∷ QName → Exp → [(Name, Exp)] → [(Name, Exp)] substituteInExports qname inlinee = map \case (name, expr) → (name, substitute (qualifiedQName qname) 0 inlinee expr) -optimizedExpression ∷ RawExp Ann → RawExp Ann +optimizedExpression ∷ Exp → Exp optimizedExpression = rewriteExpTopDown $ constantFolding + `thenRewrite` betaReduce + `thenRewrite` betaReduceUnusedParams `thenRewrite` removeUnreachableThenBranch `thenRewrite` removeUnreachableElseBranch `thenRewrite` removeIfWithEqualBranches @@ -238,6 +249,21 @@ constantFolding = Rewritten Stop $ literalBool $ a == b _ → NoChange +-- \x -> (\y -> y + 1) x ===> (\y -> y + 1) +betaReduce ∷ RewriteRule Ann +betaReduce = + pure . \case + Abs _ (ParamNamed _ _) (App _ f (Ref _ (Local _) 0)) → + Rewritten Recurse f + _ → NoChange + +betaReduceUnusedParams ∷ RewriteRule Ann +betaReduceUnusedParams = + pure . \case + App _ (Abs _ (ParamUnused _) body) _arg → + Rewritten Recurse body + _ → NoChange + removeIfWithEqualBranches ∷ RewriteRule Ann removeIfWithEqualBranches e = pure case e of @@ -289,4 +315,8 @@ isInlinableExpr expr = _ → False hasInlineAnnotation ∷ Exp → Bool - hasInlineAnnotation _ = False + hasInlineAnnotation = + getAnn >>> \case + Just (Annotation InModule Always) → True + Just (Annotation InModule Never) → False + _ → False diff --git a/lib/Language/PureScript/Backend/IR/Query.hs b/lib/Language/PureScript/Backend/IR/Query.hs index 0b4f90c..82b34c2 100644 --- a/lib/Language/PureScript/Backend/IR/Query.hs +++ b/lib/Language/PureScript/Backend/IR/Query.hs @@ -4,10 +4,13 @@ import Control.Monad.Trans.Accum (Accum, add, execAccum) import Data.Map qualified as Map import Data.Set qualified as Set import Language.PureScript.Backend.IR.Linker (UberModule (..)) +import Language.PureScript.Backend.IR.Names + ( Name (Name) + , Qualified (Imported, Local) + , runModuleName + ) import Language.PureScript.Backend.IR.Types ( Exp - , Name (..) - , Qualified (..) , bindingNames , countFreeRef , countFreeRefs @@ -15,7 +18,6 @@ import Language.PureScript.Backend.IR.Types , traverseExpBottomUp ) import Language.PureScript.Backend.IR.Types qualified as IR -import Language.PureScript.Names (runModuleName) usesRuntimeLazy ∷ UberModule → Bool usesRuntimeLazy UberModule {uberModuleBindings, uberModuleExports} = diff --git a/lib/Language/PureScript/Backend/IR/Types.hs b/lib/Language/PureScript/Backend/IR/Types.hs index 34281b2..313fb45 100644 --- a/lib/Language/PureScript/Backend/IR/Types.hs +++ b/lib/Language/PureScript/Backend/IR/Types.hs @@ -8,8 +8,16 @@ import Data.Map qualified as Map import Data.MonoidMap (MonoidMap) import Data.MonoidMap qualified as MMap import Language.PureScript.Backend.IR.Inliner qualified as Inliner -import Language.PureScript.Names (ModuleName, runModuleName) -import Quiet (Quiet (..)) +import Language.PureScript.Backend.IR.Names + ( CtorName (renderCtorName) + , FieldName + , ModuleName + , Name (Name) + , PropName + , Qualified (..) + , TyName (renderTyName) + , runModuleName + ) import Prelude hiding (show) type Ann = Maybe Inliner.Annotation @@ -145,49 +153,6 @@ ctorId modName tyName ctorName = <> "." <> renderCtorName ctorName --------------------------------------------------------------------------------- --- Names ----------------------------------------------------------------------- - -newtype Name = Name {nameToText ∷ Text} - deriving newtype (Eq, Ord) - deriving stock (Generic) - deriving (Show) via (Quiet Name) - -data QName = QName {qnameModuleName ∷ ModuleName, qnameName ∷ Name} - deriving stock (Eq, Ord, Show) - -printQName ∷ QName → Text -printQName QName {..} = - runModuleName qnameModuleName <> "∷" <> nameToText qnameName - -newtype TyName = TyName {renderTyName ∷ Text} - deriving newtype (Eq, Ord) - deriving stock (Generic) - deriving (Show) via (Quiet TyName) - -newtype CtorName = CtorName {renderCtorName ∷ Text} - deriving newtype (Eq, Ord) - deriving stock (Generic) - deriving (Show) via (Quiet CtorName) - --- TODO: is it used at all? -newtype FieldName = FieldName {renderFieldName ∷ Text} - deriving newtype (Eq, Ord) - deriving stock (Generic) - deriving (Show) via (Quiet FieldName) - -newtype PropName = PropName {renderPropName ∷ Text} - deriving newtype (Eq, Ord) - deriving stock (Generic) - deriving (Show) via (Quiet PropName) - -data Qualified a = Local a | Imported ModuleName a - deriving stock (Show, Eq, Ord, Functor) - -qualifiedQName ∷ QName → Qualified Name -qualifiedQName QName {qnameModuleName, qnameName} = - Imported qnameModuleName qnameName - -------------------------------------------------------------------------------- -- Instances ------------------------------------------------------------------- diff --git a/pslua.cabal b/pslua.cabal index cabfcad..2831a24 100644 --- a/pslua.cabal +++ b/pslua.cabal @@ -127,6 +127,7 @@ library Language.PureScript.Backend.IR.DCE Language.PureScript.Backend.IR.Inliner Language.PureScript.Backend.IR.Linker + Language.PureScript.Backend.IR.Names Language.PureScript.Backend.IR.Optimizer Language.PureScript.Backend.IR.Query Language.PureScript.Backend.IR.Types @@ -159,17 +160,18 @@ test-suite spec main-is: Main.hs other-modules: Hedgehog.Gen.Extended - Language.PureScript.Backend.IR.DCESpec + Language.PureScript.Backend.IR.DCE.Spec Language.PureScript.Backend.IR.Gen - Language.PureScript.Backend.IR.OptimizerSpec - Language.PureScript.Backend.IR.TypesSpec - Language.PureScript.Backend.IRSpec - Language.PureScript.Backend.Lua.DeadCodeEliminatorSpec + Language.PureScript.Backend.IR.Inliner.Spec + Language.PureScript.Backend.IR.Optimizer.Spec + Language.PureScript.Backend.IR.Spec + Language.PureScript.Backend.IR.Types.Spec + Language.PureScript.Backend.Lua.DeadCodeEliminator.Spec Language.PureScript.Backend.Lua.Gen - Language.PureScript.Backend.Lua.GoldenSpec + Language.PureScript.Backend.Lua.Golden.Spec Language.PureScript.Backend.Lua.Linker.Foreign.Spec - Language.PureScript.Backend.Lua.OptimizerSpec - Language.PureScript.Backend.Lua.PrinterSpec + Language.PureScript.Backend.Lua.Optimizer.Spec + Language.PureScript.Backend.Lua.Printer.Spec Test.Hspec.Expectations.Pretty Test.Hspec.Extra Test.Hspec.Golden diff --git a/test/Language/PureScript/Backend/IR/DCESpec.hs b/test/Language/PureScript/Backend/IR/DCE/Spec.hs similarity index 96% rename from test/Language/PureScript/Backend/IR/DCESpec.hs rename to test/Language/PureScript/Backend/IR/DCE/Spec.hs index ae32911..55351bf 100644 --- a/test/Language/PureScript/Backend/IR/DCESpec.hs +++ b/test/Language/PureScript/Backend/IR/DCE/Spec.hs @@ -1,4 +1,4 @@ -module Language.PureScript.Backend.IR.DCESpec where +module Language.PureScript.Backend.IR.DCE.Spec where import Data.Map qualified as Map import Hedgehog (Gen, annotate, forAll, (===)) @@ -7,13 +7,17 @@ import Hedgehog.Range qualified as Range import Language.PureScript.Backend.IR.DCE (EntryPoint (..), eliminateDeadCode) import Language.PureScript.Backend.IR.Gen qualified as Gen import Language.PureScript.Backend.IR.Linker (UberModule (..)) +import Language.PureScript.Backend.IR.Names + ( ModuleName + , Name (Name) + , QName (QName) + , Qualified (Local) + , moduleNameFromString + ) import Language.PureScript.Backend.IR.Types ( Ann , Exp , Grouping (..) - , Name (Name) - , QName (QName) - , Qualified (..) , abstraction , application , countFreeRefs @@ -25,7 +29,6 @@ import Language.PureScript.Backend.IR.Types , refImported , refLocal0 ) -import Language.PureScript.Names (ModuleName, moduleNameFromString) import Test.Hspec (Spec, describe, it) import Test.Hspec.Hedgehog.Extended (hedgehog, test) import Text.Pretty.Simple (pShow) diff --git a/test/Language/PureScript/Backend/IR/Gen.hs b/test/Language/PureScript/Backend/IR/Gen.hs index 49c3fe2..2f8bf82 100644 --- a/test/Language/PureScript/Backend/IR/Gen.hs +++ b/test/Language/PureScript/Backend/IR/Gen.hs @@ -5,6 +5,7 @@ import Hedgehog (MonadGen) import Hedgehog.Corpus qualified as Corpus import Hedgehog.Gen.Extended qualified as Gen import Hedgehog.Range qualified as Range +import Language.PureScript.Backend.IR.Names qualified as IR import Language.PureScript.Backend.IR.Types (noAnn) import Language.PureScript.Backend.IR.Types qualified as IR import Language.PureScript.Names (ModuleName, moduleNameFromString) diff --git a/test/Language/PureScript/Backend/IR/Inliner/Spec.hs b/test/Language/PureScript/Backend/IR/Inliner/Spec.hs new file mode 100644 index 0000000..e5cc88f --- /dev/null +++ b/test/Language/PureScript/Backend/IR/Inliner/Spec.hs @@ -0,0 +1,33 @@ +module Language.PureScript.Backend.IR.Inliner.Spec where + +import Hedgehog (MonadTest, failure, footnote, (===)) +import Language.PureScript.Backend.IR.Inliner + ( Annotation (..) + , InlineRecipe (..) + , InlineScope (..) + , Pragma + ) +import Language.PureScript.Backend.IR.Inliner qualified as Inliner +import Language.PureScript.Backend.IR.Names (Name (..)) +import Test.Hspec (Spec, describe) +import Test.Hspec.Hedgehog.Extended (test) +import Text.Megaparsec qualified as Megaparsec + +spec ∷ Spec +spec = describe "IR Inliner" do + describe "parses annotations" do + test "@inline foo always" do + ann ← parseAnn "@inline foo always " + ann === (Name "foo", Annotation InModule Always) + +-------------------------------------------------------------------------------- +-- Helpers --------------------------------------------------------------------- + +parseAnn ∷ MonadTest m ⇒ Text → m Pragma +parseAnn src = do + let parser = Inliner.pragmaParser <* Megaparsec.eof + case Megaparsec.parse parser "" src of + Left eb → do + footnote $ Megaparsec.errorBundlePretty eb + failure + Right ann → pure ann diff --git a/test/Language/PureScript/Backend/IR/OptimizerSpec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs similarity index 94% rename from test/Language/PureScript/Backend/IR/OptimizerSpec.hs rename to test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index 7443321..574ef66 100644 --- a/test/Language/PureScript/Backend/IR/OptimizerSpec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -1,4 +1,4 @@ -module Language.PureScript.Backend.IR.OptimizerSpec where +module Language.PureScript.Backend.IR.Optimizer.Spec where import Data.Map qualified as Map import Hedgehog (annotateShow, forAll, (===)) @@ -6,6 +6,10 @@ import Hedgehog.Gen qualified as Gen import Language.PureScript.Backend.IR.Gen qualified as Gen import Language.PureScript.Backend.IR.Linker (LinkMode (..)) import Language.PureScript.Backend.IR.Linker qualified as Linker +import Language.PureScript.Backend.IR.Names + ( Name (..) + , moduleNameFromString + ) import Language.PureScript.Backend.IR.Optimizer ( optimizedExpression , optimizedUberModule @@ -15,8 +19,6 @@ import Language.PureScript.Backend.IR.Types ( Exp , Grouping (Standalone) , Module (..) - , Name (..) - , RawExp (..) , abstraction , application @@ -27,10 +29,11 @@ import Language.PureScript.Backend.IR.Types , literalBool , literalInt , noAnn + , paramNamed + , paramUnused , refLocal - , refLocal0, paramNamed + , refLocal0 ) -import Language.PureScript.Names (moduleNameFromString) import Test.Hspec (Spec, describe) import Test.Hspec.Hedgehog.Extended (test) @@ -51,6 +54,12 @@ spec = describe "IR Optimizer" do annotateShow ifThenElseStatement elseBranch === optimizedExpression ifThenElseStatement + test "eliminates argument if corresponding parameter is unused" do + body ← forAll Gen.nonRecursiveExp + arg ← forAll Gen.exp + let f = abstraction paramUnused body + body === optimizedExpression (application f arg) + describe "inlines expressions" do test "inlines literals" do name ← forAll Gen.name diff --git a/test/Language/PureScript/Backend/IRSpec.hs b/test/Language/PureScript/Backend/IR/Spec.hs similarity index 96% rename from test/Language/PureScript/Backend/IRSpec.hs rename to test/Language/PureScript/Backend/IR/Spec.hs index 3082e6b..91e1270 100644 --- a/test/Language/PureScript/Backend/IRSpec.hs +++ b/test/Language/PureScript/Backend/IR/Spec.hs @@ -1,11 +1,11 @@ {-# OPTIONS_GHC -Wno-missing-local-signatures #-} -module Language.PureScript.Backend.IRSpec where +module Language.PureScript.Backend.IR.Spec where import Data.List.NonEmpty qualified as NE import Language.PureScript.Backend.IR (Context (..), RepM, mkCase, runRepM) +import Language.PureScript.Backend.IR.Names (Name (..), PropName (..)) import Language.PureScript.Backend.IR.Types -import Language.PureScript.Backend.IR.Types qualified as IR import Language.PureScript.CoreFn qualified as Cfn import Language.PureScript.Names qualified as PS import Language.PureScript.PSString qualified as PS @@ -436,8 +436,8 @@ spec = describe "IR representation" do ( ifThenElse (literalChar 'b' `eq` literalChar 'y') ( lets - ( IR.Standalone (noAnn, Name "b", literalChar 'y') - :| [IR.Standalone (noAnn, Name "a", literalChar 'x')] + ( Standalone (noAnn, Name "b", literalChar 'y') + :| [Standalone (noAnn, Name "a", literalChar 'x')] ) ( application (refLocal (Name "a") 0) @@ -445,8 +445,8 @@ spec = describe "IR representation" do ) ) ( lets - ( IR.Standalone (noAnn, Name "o2", literalChar 'y') - :| [IR.Standalone (noAnn, Name "o1", literalChar 'x')] + ( Standalone (noAnn, Name "o2", literalChar 'y') + :| [Standalone (noAnn, Name "o1", literalChar 'x')] ) ( application (refLocal (Name "o2") 0) @@ -455,8 +455,8 @@ spec = describe "IR representation" do ) ) ( lets - ( IR.Standalone (noAnn, Name "o2", literalChar 'y') - :| [IR.Standalone (noAnn, Name "o1", literalChar 'x')] + ( Standalone (noAnn, Name "o2", literalChar 'y') + :| [Standalone (noAnn, Name "o1", literalChar 'x')] ) ( application (refLocal (Name "o2") 0) @@ -472,8 +472,8 @@ representedCase ∷ MonadFail m ⇒ [Cfn.Expr Cfn.Ann] → [Cfn.CaseAlternative Cfn.Ann] - → m IR.Exp -representedCase es alts = runRepresentM (mkCase es (NE.fromList alts)) + → m Exp +representedCase es alts = runRepresentM (mkCase noAnn es (NE.fromList alts)) runRepresentM ∷ MonadFail m ⇒ RepM Exp → m Exp runRepresentM rm = @@ -486,7 +486,7 @@ runRepresentM rm = , contextDataTypes = mempty , lastGeneratedNameIndex = 0 , needsRuntimeLazy = Any False - , annotations = [] + , annotations = mempty } rm ) @@ -556,4 +556,4 @@ cfnApp ∷ Cfn.Expr Cfn.Ann → Cfn.Expr Cfn.Ann → Cfn.Expr Cfn.Ann cfnApp = Cfn.App ann let1 ∷ Name → Exp → Exp → Exp -let1 n e = lets (pure (IR.Standalone (noAnn, n, e))) +let1 n e = lets (pure (Standalone (noAnn, n, e))) diff --git a/test/Language/PureScript/Backend/IR/TypesSpec.hs b/test/Language/PureScript/Backend/IR/Types/Spec.hs similarity index 96% rename from test/Language/PureScript/Backend/IR/TypesSpec.hs rename to test/Language/PureScript/Backend/IR/Types/Spec.hs index ced3d34..88d7393 100644 --- a/test/Language/PureScript/Backend/IR/TypesSpec.hs +++ b/test/Language/PureScript/Backend/IR/Types/Spec.hs @@ -1,13 +1,15 @@ -module Language.PureScript.Backend.IR.TypesSpec where +module Language.PureScript.Backend.IR.Types.Spec where import Data.Map qualified as Map import Hedgehog ((===)) +import Language.PureScript.Backend.IR.Names + ( ModuleName (..) + , Name (..) + , Qualified (Imported) + ) import Language.PureScript.Backend.IR.Types ( Exp , Grouping (..) - , Name (..) - , Parameter (ParamNamed, ParamUnused) - , Qualified (..) , abstraction , application , countFreeRefs @@ -19,7 +21,6 @@ import Language.PureScript.Backend.IR.Types , refImported , refLocal ) -import Language.PureScript.Names (ModuleName (..)) import Test.Hspec (Spec, describe) import Test.Hspec.Hedgehog.Extended (test) diff --git a/test/Language/PureScript/Backend/Lua/DeadCodeEliminatorSpec.hs b/test/Language/PureScript/Backend/Lua/DeadCodeEliminator/Spec.hs similarity index 99% rename from test/Language/PureScript/Backend/Lua/DeadCodeEliminatorSpec.hs rename to test/Language/PureScript/Backend/Lua/DeadCodeEliminator/Spec.hs index 8a7e9e4..ca4ba77 100644 --- a/test/Language/PureScript/Backend/Lua/DeadCodeEliminatorSpec.hs +++ b/test/Language/PureScript/Backend/Lua/DeadCodeEliminator/Spec.hs @@ -1,6 +1,6 @@ {-# LANGUAGE QuasiQuotes #-} -module Language.PureScript.Backend.Lua.DeadCodeEliminatorSpec where +module Language.PureScript.Backend.Lua.DeadCodeEliminator.Spec where import Control.Monad.Accum (add) import Control.Monad.Trans.Accum (Accum, execAccum) diff --git a/test/Language/PureScript/Backend/Lua/GoldenSpec.hs b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs similarity index 99% rename from test/Language/PureScript/Backend/Lua/GoldenSpec.hs rename to test/Language/PureScript/Backend/Lua/Golden/Spec.hs index ea696c7..0683eca 100644 --- a/test/Language/PureScript/Backend/Lua/GoldenSpec.hs +++ b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs @@ -1,7 +1,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} -module Language.PureScript.Backend.Lua.GoldenSpec where +module Language.PureScript.Backend.Lua.Golden.Spec where import Control.Monad.Catch (MonadMask) import Control.Monad.Oops qualified as Oops diff --git a/test/Language/PureScript/Backend/Lua/OptimizerSpec.hs b/test/Language/PureScript/Backend/Lua/Optimizer/Spec.hs similarity index 97% rename from test/Language/PureScript/Backend/Lua/OptimizerSpec.hs rename to test/Language/PureScript/Backend/Lua/Optimizer/Spec.hs index 8e4a1ac..9910a2a 100644 --- a/test/Language/PureScript/Backend/Lua/OptimizerSpec.hs +++ b/test/Language/PureScript/Backend/Lua/Optimizer/Spec.hs @@ -1,6 +1,6 @@ {-# LANGUAGE QuasiQuotes #-} -module Language.PureScript.Backend.Lua.OptimizerSpec where +module Language.PureScript.Backend.Lua.Optimizer.Spec where import Language.PureScript.Backend.Lua.Name (name) import Language.PureScript.Backend.Lua.Optimizer diff --git a/test/Language/PureScript/Backend/Lua/PrinterSpec.hs b/test/Language/PureScript/Backend/Lua/Printer/Spec.hs similarity index 99% rename from test/Language/PureScript/Backend/Lua/PrinterSpec.hs rename to test/Language/PureScript/Backend/Lua/Printer/Spec.hs index d0478fc..f1f4857 100644 --- a/test/Language/PureScript/Backend/Lua/PrinterSpec.hs +++ b/test/Language/PureScript/Backend/Lua/Printer/Spec.hs @@ -1,7 +1,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# OPTIONS_GHC -Wno-missing-local-signatures #-} -module Language.PureScript.Backend.Lua.PrinterSpec where +module Language.PureScript.Backend.Lua.Printer.Spec where import Data.Text qualified as Text import Language.PureScript.Backend.Lua.Name qualified as Lua diff --git a/test/Main.hs b/test/Main.hs index 37e63ec..90ae7b2 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,19 +1,21 @@ module Main where -import Language.PureScript.Backend.IR.DCESpec qualified as IrDce -import Language.PureScript.Backend.IR.OptimizerSpec qualified as IROptimizer -import Language.PureScript.Backend.IR.TypesSpec qualified as Types -import Language.PureScript.Backend.IRSpec qualified as IR -import Language.PureScript.Backend.Lua.DeadCodeEliminatorSpec qualified as LuaDce -import Language.PureScript.Backend.Lua.GoldenSpec qualified as Golden -import Language.PureScript.Backend.Lua.OptimizerSpec qualified as LuaOptimizer -import Language.PureScript.Backend.Lua.PrinterSpec qualified as Printer +import Language.PureScript.Backend.IR.DCE.Spec qualified as IrDce +import Language.PureScript.Backend.IR.Inliner.Spec qualified as Inliner +import Language.PureScript.Backend.IR.Optimizer.Spec qualified as IROptimizer +import Language.PureScript.Backend.IR.Spec qualified as IR +import Language.PureScript.Backend.IR.Types.Spec qualified as Types +import Language.PureScript.Backend.Lua.DeadCodeEliminator.Spec qualified as LuaDce +import Language.PureScript.Backend.Lua.Golden.Spec qualified as Golden import Language.PureScript.Backend.Lua.Linker.Foreign.Spec qualified as LuaLinkerForeign +import Language.PureScript.Backend.Lua.Optimizer.Spec qualified as LuaOptimizer +import Language.PureScript.Backend.Lua.Printer.Spec qualified as Printer import Test.Hspec (hspec) main ∷ IO () main = hspec do IR.spec + Inliner.spec Golden.spec IrDce.spec LuaDce.spec diff --git a/test/ps/golden/Golden/Annotations/M1.purs b/test/ps/golden/Golden/Annotations/M1.purs new file mode 100644 index 0000000..e76633b --- /dev/null +++ b/test/ps/golden/Golden/Annotations/M1.purs @@ -0,0 +1,6 @@ +-- @inline inlineMe always +module Golden.Annotations.M1 where + +inlineMe :: Int -> Int +inlineMe 1 = 2 +inlineMe x = x diff --git a/test/ps/golden/Golden/Annotations/M2.purs b/test/ps/golden/Golden/Annotations/M2.purs new file mode 100644 index 0000000..ba333a7 --- /dev/null +++ b/test/ps/golden/Golden/Annotations/M2.purs @@ -0,0 +1,6 @@ +module Golden.Annotations.M2 where + +import Golden.Annotations.M1 (inlineMe) + +inlineIntoMe :: Int -> Int +inlineIntoMe i = inlineMe (inlineMe (inlineMe i)) diff --git a/test/ps/golden/Golden/Beta/Test.purs b/test/ps/golden/Golden/Beta/Test.purs new file mode 100644 index 0000000..56e7db5 --- /dev/null +++ b/test/ps/golden/Golden/Beta/Test.purs @@ -0,0 +1,8 @@ +module Golden.Beta.Test (g) where + +f :: Int -> Int +f 42 = 42 +f _ = 1 + +g :: Int -> Int +g x = f x diff --git a/test/ps/golden/Golden/TestBug1.purs b/test/ps/golden/Golden/Bug1/Test.purs similarity index 72% rename from test/ps/golden/Golden/TestBug1.purs rename to test/ps/golden/Golden/Bug1/Test.purs index 83dbec5..0972ac5 100644 --- a/test/ps/golden/Golden/TestBug1.purs +++ b/test/ps/golden/Golden/Bug1/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestBug1 where +module Golden.Bug1.Test where test :: Int test = diff --git a/test/ps/golden/Golden/TestCaseStatements.purs b/test/ps/golden/Golden/CaseStatements/Test.purs similarity index 94% rename from test/ps/golden/Golden/TestCaseStatements.purs rename to test/ps/golden/Golden/CaseStatements/Test.purs index 9d6f41d..05dbf05 100644 --- a/test/ps/golden/Golden/TestCaseStatements.purs +++ b/test/ps/golden/Golden/CaseStatements/Test.purs @@ -1,6 +1,6 @@ -module Golden.TestCaseStatements where +module Golden.CaseStatements.Test where -import Golden.TestValues (f) +import Golden.Values.Test (f) a ∷ Int a = 1 diff --git a/test/ps/golden/Golden/TestCurrying.purs b/test/ps/golden/Golden/Currying/Test.purs similarity index 78% rename from test/ps/golden/Golden/TestCurrying.purs rename to test/ps/golden/Golden/Currying/Test.purs index 24976fd..122bc6a 100644 --- a/test/ps/golden/Golden/TestCurrying.purs +++ b/test/ps/golden/Golden/Currying/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestCurrying where +module Golden.Currying.Test where apply :: forall a b. (a -> b) -> a -> b apply f x = f x diff --git a/test/ps/golden/Golden/TestDataDeclarations1.purs b/test/ps/golden/Golden/DataDeclarations/Test1.purs similarity index 84% rename from test/ps/golden/Golden/TestDataDeclarations1.purs rename to test/ps/golden/Golden/DataDeclarations/Test1.purs index 8751cd4..beadf8b 100644 --- a/test/ps/golden/Golden/TestDataDeclarations1.purs +++ b/test/ps/golden/Golden/DataDeclarations/Test1.purs @@ -1,4 +1,4 @@ -module Golden.TestDataDeclarations1 where +module Golden.DataDeclarations.Test1 where data Void data Unit = U diff --git a/test/ps/golden/Golden/TestDataDeclarations2.purs b/test/ps/golden/Golden/DataDeclarations/Test2.purs similarity index 59% rename from test/ps/golden/Golden/TestDataDeclarations2.purs rename to test/ps/golden/Golden/DataDeclarations/Test2.purs index 905d7e7..5b1eae6 100644 --- a/test/ps/golden/Golden/TestDataDeclarations2.purs +++ b/test/ps/golden/Golden/DataDeclarations/Test2.purs @@ -1,6 +1,6 @@ -module Golden.TestDataDeclarations2 where +module Golden.DataDeclarations.Test2 where -import Golden.TestDataDeclarations1 as TDD1 +import Golden.DataDeclarations.Test1 as TDD1 data TySameName = CtorSameName diff --git a/test/ps/golden/Golden/TestForeign.lua b/test/ps/golden/Golden/Foreign/Test.lua similarity index 100% rename from test/ps/golden/Golden/TestForeign.lua rename to test/ps/golden/Golden/Foreign/Test.lua diff --git a/test/ps/golden/Golden/Foreign/Test.purs b/test/ps/golden/Golden/Foreign/Test.purs new file mode 100644 index 0000000..31d9027 --- /dev/null +++ b/test/ps/golden/Golden/Foreign/Test.purs @@ -0,0 +1,3 @@ +module Golden.Foreign.Test where + +foreign import foo :: Int diff --git a/test/ps/golden/Golden/TestHelloPrelude.purs b/test/ps/golden/Golden/HelloPrelude/Test.purs similarity index 65% rename from test/ps/golden/Golden/TestHelloPrelude.purs rename to test/ps/golden/Golden/HelloPrelude/Test.purs index 49389f4..e141d24 100644 --- a/test/ps/golden/Golden/TestHelloPrelude.purs +++ b/test/ps/golden/Golden/HelloPrelude/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestHelloPrelude where +module Golden.HelloPrelude.Test where import Prelude import Effect (Effect) diff --git a/test/ps/golden/Golden/TestInline.purs b/test/ps/golden/Golden/Inline/Test.purs similarity index 80% rename from test/ps/golden/Golden/TestInline.purs rename to test/ps/golden/Golden/Inline/Test.purs index 2f607e1..447ac04 100644 --- a/test/ps/golden/Golden/TestInline.purs +++ b/test/ps/golden/Golden/Inline/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestInline where +module Golden.Inline.Test where main :: Int main = diff --git a/test/ps/golden/Golden/TestNameShadowing.purs b/test/ps/golden/Golden/NameShadowing/Test.purs similarity index 80% rename from test/ps/golden/Golden/TestNameShadowing.purs rename to test/ps/golden/Golden/NameShadowing/Test.purs index 04504e3..fcb4245 100644 --- a/test/ps/golden/Golden/TestNameShadowing.purs +++ b/test/ps/golden/Golden/NameShadowing/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestNameShadowing (b, c) where +module Golden.NameShadowing.Test (b, c) where a :: Int -> Int a x = f x 1 diff --git a/test/ps/golden/Golden/TestNewtype.purs b/test/ps/golden/Golden/Newtype/Test.purs similarity index 75% rename from test/ps/golden/Golden/TestNewtype.purs rename to test/ps/golden/Golden/Newtype/Test.purs index 537c377..9c22d57 100644 --- a/test/ps/golden/Golden/TestNewtype.purs +++ b/test/ps/golden/Golden/Newtype/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestNewtype where +module Golden.Newtype.Test where newtype NT = NT { foo :: Int } diff --git a/test/ps/golden/Golden/TestPatternMatching1.purs b/test/ps/golden/Golden/PatternMatching/Test1.purs similarity index 87% rename from test/ps/golden/Golden/TestPatternMatching1.purs rename to test/ps/golden/Golden/PatternMatching/Test1.purs index 71e1978..be1871b 100644 --- a/test/ps/golden/Golden/TestPatternMatching1.purs +++ b/test/ps/golden/Golden/PatternMatching/Test1.purs @@ -1,4 +1,4 @@ -module Golden.TestPatternMatching1 where +module Golden.PatternMatching.Test1 where data N = Zero | Succ N data E = Num N | Not E diff --git a/test/ps/golden/Golden/TestPatternMatching2.purs b/test/ps/golden/Golden/PatternMatching/Test2.purs similarity index 77% rename from test/ps/golden/Golden/TestPatternMatching2.purs rename to test/ps/golden/Golden/PatternMatching/Test2.purs index 590a412..616434b 100644 --- a/test/ps/golden/Golden/TestPatternMatching2.purs +++ b/test/ps/golden/Golden/PatternMatching/Test2.purs @@ -1,6 +1,6 @@ -module Golden.TestPatternMatching2 where +module Golden.PatternMatching.Test2 where -import Golden.TestPatternMatching1 as P +import Golden.PatternMatching.Test1 as P data N = Zero | Succ N | Add N N | Mul N N diff --git a/test/ps/golden/Golden/TestRecDataDefs.purs b/test/ps/golden/Golden/RecDataDefs/Test.purs similarity index 73% rename from test/ps/golden/Golden/TestRecDataDefs.purs rename to test/ps/golden/Golden/RecDataDefs/Test.purs index c683c61..4b725dc 100644 --- a/test/ps/golden/Golden/TestRecDataDefs.purs +++ b/test/ps/golden/Golden/RecDataDefs/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestRecDataDefs where +module Golden.RecDataDefs.Test where data A = A | AB B data B = B | BA A diff --git a/test/ps/golden/Golden/TestRecordsAccess.purs b/test/ps/golden/Golden/RecordsAccess/Test.purs similarity index 84% rename from test/ps/golden/Golden/TestRecordsAccess.purs rename to test/ps/golden/Golden/RecordsAccess/Test.purs index 83ea164..141a2e0 100644 --- a/test/ps/golden/Golden/TestRecordsAccess.purs +++ b/test/ps/golden/Golden/RecordsAccess/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestRecordsAccess where +module Golden.RecordsAccess.Test where type R = { x :: Int, y :: Boolean } diff --git a/test/ps/golden/Golden/TestRecordsUpdate.purs b/test/ps/golden/Golden/RecordsUpdate/Test.purs similarity index 90% rename from test/ps/golden/Golden/TestRecordsUpdate.purs rename to test/ps/golden/Golden/RecordsUpdate/Test.purs index 66143c2..3d10d31 100644 --- a/test/ps/golden/Golden/TestRecordsUpdate.purs +++ b/test/ps/golden/Golden/RecordsUpdate/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestRecordsUpdate where +module Golden.RecordsUpdate.Test where type R = { x :: Int, y :: Boolean, z :: Z } type Z = { z :: String , p :: Char } diff --git a/test/ps/golden/Golden/TestRecursiveBindings.purs b/test/ps/golden/Golden/RecursiveBindings/Test.purs similarity index 96% rename from test/ps/golden/Golden/TestRecursiveBindings.purs rename to test/ps/golden/Golden/RecursiveBindings/Test.purs index 0cd4f8b..f9b6ceb 100644 --- a/test/ps/golden/Golden/TestRecursiveBindings.purs +++ b/test/ps/golden/Golden/RecursiveBindings/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestRecursiveBindings where +module Golden.RecursiveBindings.Test where letRec :: Boolean letRec = diff --git a/test/ps/golden/Golden/TestReexport.purs b/test/ps/golden/Golden/Reexport/Test.purs similarity index 73% rename from test/ps/golden/Golden/TestReexport.purs rename to test/ps/golden/Golden/Reexport/Test.purs index 84a8a55..1146532 100644 --- a/test/ps/golden/Golden/TestReexport.purs +++ b/test/ps/golden/Golden/Reexport/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestReexport where +module Golden.Reexport.Test where import Golden.Reexport.ReExports diff --git a/test/ps/golden/Golden/TestReturnTableField.lua b/test/ps/golden/Golden/ReturnTableField/Test.lua similarity index 100% rename from test/ps/golden/Golden/TestReturnTableField.lua rename to test/ps/golden/Golden/ReturnTableField/Test.lua diff --git a/test/ps/golden/Golden/TestReturnTableField.purs b/test/ps/golden/Golden/ReturnTableField/Test.purs similarity index 100% rename from test/ps/golden/Golden/TestReturnTableField.purs rename to test/ps/golden/Golden/ReturnTableField/Test.purs diff --git a/test/ps/golden/Golden/TestForeign.purs b/test/ps/golden/Golden/TestForeign.purs deleted file mode 100644 index c8de9ca..0000000 --- a/test/ps/golden/Golden/TestForeign.purs +++ /dev/null @@ -1,3 +0,0 @@ -module Golden.TestForeign where - -foreign import foo :: Int diff --git a/test/ps/golden/Golden/TestUnbinding.purs b/test/ps/golden/Golden/Unbinding/Test.purs similarity index 52% rename from test/ps/golden/Golden/TestUnbinding.purs rename to test/ps/golden/Golden/Unbinding/Test.purs index d70648e..3b4c7ae 100644 --- a/test/ps/golden/Golden/TestUnbinding.purs +++ b/test/ps/golden/Golden/Unbinding/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestUnbinding where +module Golden.Unbinding.Test where a = 1 b = 2 diff --git a/test/ps/golden/Golden/TestValues.purs b/test/ps/golden/Golden/Values/Test.purs similarity index 85% rename from test/ps/golden/Golden/TestValues.purs rename to test/ps/golden/Golden/Values/Test.purs index 8ee45d3..a1df82b 100644 --- a/test/ps/golden/Golden/TestValues.purs +++ b/test/ps/golden/Golden/Values/Test.purs @@ -1,4 +1,4 @@ -module Golden.TestValues where +module Golden.Values.Test where i :: Int i = 1 diff --git a/test/ps/output/Golden.Annotations.M1/corefn.json b/test/ps/output/Golden.Annotations.M1/corefn.json new file mode 100644 index 0000000..57d8e07 --- /dev/null +++ b/test/ps/output/Golden.Annotations.M1/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[{"LineComment":" @inline inlineMe always"}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,11],"start":[5,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"binderType":"VarBinder","identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Var","value":{"identifier":"x","sourcePos":[6,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"inlineMe"}],"exports":["inlineMe"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[2,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M1"],"modulePath":"golden/Golden/Annotations/M1.purs","reExports":{},"sourceSpan":{"end":[6,15],"start":[2,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Annotations.M1/golden.ir b/test/ps/output/Golden.Annotations.M1/golden.ir new file mode 100644 index 0000000..c1afda7 --- /dev/null +++ b/test/ps/output/Golden.Annotations.M1/golden.ir @@ -0,0 +1,14 @@ +UberModule + { uberModuleBindings = [], uberModuleExports = + [ + ( Name "inlineMe", Abs + ( Just ( Annotation InModule Always ) ) + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 2 ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Annotations.M1/golden.lua b/test/ps/output/Golden.Annotations.M1/golden.lua new file mode 100644 index 0000000..0eb0dc8 --- /dev/null +++ b/test/ps/output/Golden.Annotations.M1/golden.lua @@ -0,0 +1 @@ +return { inlineMe = function(v) if 1 == v then return 2 else return v end end } diff --git a/test/ps/output/Golden.Annotations.M2/corefn.json b/test/ps/output/Golden.Annotations.M2/corefn.json new file mode 100644 index 0000000..274c003 --- /dev/null +++ b/test/ps/output/Golden.Annotations.M2/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"argument":"i","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,26],"start":[6,18]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,50],"start":[6,18]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,36],"start":[6,28]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,49],"start":[6,28]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,46],"start":[6,38]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,47]}},"type":"Var","value":{"identifier":"i","sourcePos":[6,1]}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"identifier":"inlineIntoMe"}],"exports":["inlineIntoMe"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,50],"start":[1,1]}},"moduleName":["Golden","Annotations","M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,50],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M2"],"modulePath":"golden/Golden/Annotations/M2.purs","reExports":{},"sourceSpan":{"end":[6,50],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Annotations.M2/golden.ir b/test/ps/output/Golden.Annotations.M2/golden.ir new file mode 100644 index 0000000..72fb45b --- /dev/null +++ b/test/ps/output/Golden.Annotations.M2/golden.ir @@ -0,0 +1,42 @@ +UberModule + { uberModuleBindings = [], uberModuleExports = + [ + ( Name "inlineIntoMe", Abs Nothing + ( ParamNamed Nothing ( Name "i" ) ) + ( App Nothing + ( Abs + ( Just ( Annotation InModule Always ) ) + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 2 ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( App Nothing + ( Abs + ( Just ( Annotation InModule Always ) ) + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 2 ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( App Nothing + ( Abs + ( Just ( Annotation InModule Always ) ) + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 2 ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "i" ) ) 0 ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Annotations.M2/golden.lua b/test/ps/output/Golden.Annotations.M2/golden.lua new file mode 100644 index 0000000..55f275f --- /dev/null +++ b/test/ps/output/Golden.Annotations.M2/golden.lua @@ -0,0 +1,9 @@ +return { + inlineIntoMe = function(i) + return (function(v) + if 1 == v then return 2 else return v end + end)((function(v) + if 1 == v then return 2 else return v end + end)((function(v) if 1 == v then return 2 else return v end end)(i))) + end +} diff --git a/test/ps/output/Golden.Beta.Test/corefn.json b/test/ps/output/Golden.Beta.Test/corefn.json new file mode 100644 index 0000000..a1ed5c4 --- /dev/null +++ b/test/ps/output/Golden.Beta.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,5],"start":[4,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":42}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,4],"start":[5,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,8],"start":[8,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Beta","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[8,1]}},"type":"App"},"type":"Abs"},"identifier":"g"}],"exports":["g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Golden","Beta","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Beta","Test"],"modulePath":"golden/Golden/Beta/Test.purs","reExports":{},"sourceSpan":{"end":[8,10],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Beta.Test/golden.ir b/test/ps/output/Golden.Beta.Test/golden.ir new file mode 100644 index 0000000..5bc4afc --- /dev/null +++ b/test/ps/output/Golden.Beta.Test/golden.ir @@ -0,0 +1,13 @@ +UberModule + { uberModuleBindings = [], uberModuleExports = + [ + ( Name "g", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 42 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 42 ) + ( LiteralInt Nothing 1 ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Beta.Test/golden.lua b/test/ps/output/Golden.Beta.Test/golden.lua new file mode 100644 index 0000000..facc122 --- /dev/null +++ b/test/ps/output/Golden.Beta.Test/golden.lua @@ -0,0 +1 @@ +return { g = function(v) if 42 == v then return 42 else return 1 end end } diff --git a/test/ps/output/Golden.TestBug1/corefn.json b/test/ps/output/Golden.Bug1.Test/corefn.json similarity index 94% rename from test/ps/output/Golden.TestBug1/corefn.json rename to test/ps/output/Golden.Bug1.Test/corefn.json index 2224bc2..df381f9 100644 --- a/test/ps/output/Golden.TestBug1/corefn.json +++ b/test/ps/output/Golden.Bug1.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"r","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,14]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[5,28],"start":[5,22]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,22]}},"type":"Var","value":{"identifier":"r","sourcePos":[5,7]}},"fieldName":"elem","type":"Accessor"}]]}},"type":"Abs"},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"elem","type":"Accessor"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,14]}},"type":"Var","value":{"identifier":"go","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,17]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[6,26],"start":[6,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"test"}],"exports":["test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestBug1"],"modulePath":"golden/Golden/TestBug1.purs","reExports":{},"sourceSpan":{"end":[6,29],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"r","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,14]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[5,28],"start":[5,22]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,22]}},"type":"Var","value":{"identifier":"r","sourcePos":[5,7]}},"fieldName":"elem","type":"Accessor"}]]}},"type":"Abs"},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"elem","type":"Accessor"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,14]}},"type":"Var","value":{"identifier":"go","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,17]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[6,26],"start":[6,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"test"}],"exports":["test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Bug1","Test"],"modulePath":"golden/Golden/Bug1/Test.purs","reExports":{},"sourceSpan":{"end":[6,29],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestBug1/golden.ir b/test/ps/output/Golden.Bug1.Test/golden.ir similarity index 100% rename from test/ps/output/Golden.TestBug1/golden.ir rename to test/ps/output/Golden.Bug1.Test/golden.ir diff --git a/test/ps/output/Golden.TestBug1/golden.lua b/test/ps/output/Golden.Bug1.Test/golden.lua similarity index 100% rename from test/ps/output/Golden.TestBug1/golden.lua rename to test/ps/output/Golden.Bug1.Test/golden.lua diff --git a/test/ps/output/Golden.CaseStatements.Test/corefn.json b/test/ps/output/Golden.CaseStatements.Test/corefn.json new file mode 100644 index 0000000..130ca43 --- /dev/null +++ b/test/ps/output/Golden.CaseStatements.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"J","fieldNames":["value0"],"type":"Constructor","typeName":"M"},"identifier":"J"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"N","fieldNames":[],"type":"Constructor","typeName":"M"},"identifier":"N"},{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"caseAlternatives":[{"binders":[],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[59,14],"start":[59,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[59,10],"start":[59,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}},{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[60,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[60,9],"start":[60,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}}],"isGuarded":true}],"caseExpressions":[],"type":"Case"},"identifier":"multipleGuards"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,8],"start":[42,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"y"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,13],"start":[42,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,6],"start":[43,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[43,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,8],"start":[41,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"x"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,14],"start":[41,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"J","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,22],"start":[41,21]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"N","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,31]}},"type":"Var","value":{"identifier":"y","sourcePos":[41,13]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,26]}},"type":"Var","value":{"identifier":"n","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,19],"start":[41,18]}},"type":"Var","value":{"identifier":"m","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Let"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"d"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,9],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,8],"start":[9,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,9],"start":[15,8]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,21],"start":[15,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,13],"start":[15,12]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,12],"start":[16,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":3}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,15],"start":[16,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,26],"start":[16,25]}},"type":"Var","value":{"identifier":"y","sourcePos":[16,5]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,20]}},"type":"Var","value":{"identifier":"z","sourcePos":[16,8]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,12],"start":[17,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":4}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,26],"start":[17,25]}},"type":"Var","value":{"identifier":"z","sourcePos":[17,8]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,19],"start":[17,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,20]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,5]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,8]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"b"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,28],"start":[14,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,19]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,15],"start":[14,14]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,16]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Let"},"identifier":"c"}],"exports":["a","b","c","J","N","d","multipleGuards"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","CaseStatements","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","CaseStatements","Test"],"modulePath":"golden/Golden/CaseStatements/Test.purs","reExports":{},"sourceSpan":{"end":[60,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestCaseStatements/golden.ir b/test/ps/output/Golden.CaseStatements.Test/golden.ir similarity index 85% rename from test/ps/output/Golden.TestCaseStatements/golden.ir rename to test/ps/output/Golden.CaseStatements.Test/golden.ir index 927bf63..582af77 100644 --- a/test/ps/output/Golden.TestCaseStatements/golden.ir +++ b/test/ps/output/Golden.CaseStatements.Test/golden.ir @@ -2,7 +2,7 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestValues", qnameName = Name "f" + { qnameModuleName = ModuleName "Golden.Values.Test", qnameName = Name "f" }, Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) ], uberModuleExports = @@ -16,14 +16,14 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralBool Nothing True ) ( App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestValues" ) ( Name "f" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.Values.Test" ) ( Name "f" ) ) 0 ) ( LiteralInt Nothing 2 ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralBool Nothing True ) ( App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestValues" ) ( Name "f" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.Values.Test" ) ( Name "f" ) ) 0 ) ( LiteralInt Nothing 1 ) ) ) @@ -34,13 +34,13 @@ UberModule ) ), ( Name "J", Ctor Nothing SumType - ( ModuleName "Golden.TestCaseStatements" ) + ( ModuleName "Golden.CaseStatements.Test" ) ( TyName "M" ) ( CtorName "J" ) [ FieldName "value0" ] ), ( Name "N", Ctor Nothing SumType - ( ModuleName "Golden.TestCaseStatements" ) + ( ModuleName "Golden.CaseStatements.Test" ) ( TyName "M" ) ( CtorName "N" ) [] ), @@ -67,12 +67,12 @@ UberModule ( Eq Nothing ( LiteralChar Nothing 'x' ) ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestCaseStatements∷M.J" ) + ( LiteralString Nothing "Golden.CaseStatements.Test∷M.J" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m" ) ) 0 ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestCaseStatements∷M.N" ) + ( LiteralString Nothing "Golden.CaseStatements.Test∷M.N" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "n" ) ) 0 ) ) ) ( ObjectProp Nothing diff --git a/test/ps/output/Golden.TestCaseStatements/golden.lua b/test/ps/output/Golden.CaseStatements.Test/golden.lua similarity index 68% rename from test/ps/output/Golden.TestCaseStatements/golden.lua rename to test/ps/output/Golden.CaseStatements.Test/golden.lua index 68809e8..51e5a46 100644 --- a/test/ps/output/Golden.TestCaseStatements/golden.lua +++ b/test/ps/output/Golden.CaseStatements.Test/golden.lua @@ -1,13 +1,13 @@ -local Golden_TestValues_I_f = function(unused0) return true end +local Golden_Values_Test_I_f = function(unused0) return true end return { a = 1, b = "b", c = (function() local v = function(unused1) return 0 end return (function() - if true == Golden_TestValues_I_f(2) then + if true == Golden_Values_Test_I_f(2) then return (function() - if true == Golden_TestValues_I_f(1) then + if true == Golden_Values_Test_I_f(1) then return 42 else return v(true) @@ -19,9 +19,9 @@ return { end)() end)(), J = function(value0) - return { ["$ctor"] = "Golden.TestCaseStatements∷M.J", value0 = value0 } + return { ["$ctor"] = "Golden.CaseStatements.Test∷M.J", value0 = value0 } end, - N = { ["$ctor"] = "Golden.TestCaseStatements∷M.N" }, + N = { ["$ctor"] = "Golden.CaseStatements.Test∷M.N" }, d = function(m) return function(n) return function(x) @@ -31,9 +31,9 @@ return { return (function() if "x" == x then return (function() - if "Golden.TestCaseStatements∷M.J" == m["$ctor"] then + if "Golden.CaseStatements.Test∷M.J" == m["$ctor"] then return (function() - if "Golden.TestCaseStatements∷M.N" == n["$ctor"] then + if "Golden.CaseStatements.Test∷M.N" == n["$ctor"] then return m.value0 else return v(true) diff --git a/test/ps/output/Golden.TestCurrying/corefn.json b/test/ps/output/Golden.Currying.Test/corefn.json similarity index 92% rename from test/ps/output/Golden.TestCurrying/corefn.json rename to test/ps/output/Golden.Currying.Test/corefn.json index 9f4f5d2..535b661 100644 --- a/test/ps/output/Golden.TestCurrying/corefn.json +++ b/test/ps/output/Golden.Currying.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"i","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[7,13]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"f1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,13]}},"type":"Var","value":{"identifier":"f1","sourcePos":[4,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"apply"}],"exports":["apply","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestCurrying"],"modulePath":"golden/Golden/TestCurrying.purs","reExports":{},"sourceSpan":{"end":[7,17],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"i","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[7,13]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"f1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,13]}},"type":"Var","value":{"identifier":"f1","sourcePos":[4,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"apply"}],"exports":["apply","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Currying","Test"],"modulePath":"golden/Golden/Currying/Test.purs","reExports":{},"sourceSpan":{"end":[7,17],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestCurrying/golden.ir b/test/ps/output/Golden.Currying.Test/golden.ir similarity index 65% rename from test/ps/output/Golden.TestCurrying/golden.ir rename to test/ps/output/Golden.Currying.Test/golden.ir index e5dc4d0..8c0f708 100644 --- a/test/ps/output/Golden.TestCurrying/golden.ir +++ b/test/ps/output/Golden.Currying.Test/golden.ir @@ -3,13 +3,7 @@ UberModule [ ( Name "apply", Abs Nothing ( ParamNamed Nothing ( Name "f1" ) ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "x" ) ) - ( App Nothing - ( Ref Nothing ( Local ( Name "f1" ) ) 0 ) - ( Ref Nothing ( Local ( Name "x" ) ) 0 ) - ) - ) + ( Ref Nothing ( Local ( Name "f1" ) ) 0 ) ), ( Name "f", Abs Nothing ( ParamUnused Nothing ) ( Abs Nothing ( ParamUnused Nothing ) diff --git a/test/ps/output/Golden.TestCurrying/golden.lua b/test/ps/output/Golden.Currying.Test/golden.lua similarity index 70% rename from test/ps/output/Golden.TestCurrying/golden.lua rename to test/ps/output/Golden.Currying.Test/golden.lua index 9e5c696..e939fca 100644 --- a/test/ps/output/Golden.TestCurrying/golden.lua +++ b/test/ps/output/Golden.Currying.Test/golden.lua @@ -1,5 +1,5 @@ return { - apply = function(f1) return function(x) return f1(x) end end, + apply = function(f1) return f1 end, f = function(unused3) return function(unused2) return function(unused1) return function(unused0) return "ok" end end diff --git a/test/ps/output/Golden.TestDataDeclarations1/corefn.json b/test/ps/output/Golden.DataDeclarations.Test1/corefn.json similarity index 93% rename from test/ps/output/Golden.TestDataDeclarations1/corefn.json rename to test/ps/output/Golden.DataDeclarations.Test1/corefn.json index 9a19287..f5bddf7 100644 --- a/test/ps/output/Golden.TestDataDeclarations1/corefn.json +++ b/test/ps/output/Golden.DataDeclarations.Test1/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"constructorName":"U","fieldNames":[],"type":"Constructor","typeName":"Unit"},"identifier":"U"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S0","fieldNames":[],"type":"Constructor","typeName":"TSum"},"identifier":"S0"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S1","fieldNames":["value0"],"type":"Constructor","typeName":"TSum"},"identifier":"S1"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S2","fieldNames":["value0","value1"],"type":"Constructor","typeName":"TSum"},"identifier":"S2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"constructorName":"PF","fieldNames":["value0"],"type":"Constructor","typeName":"TProductWithFields"},"identifier":"PF"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"constructorName":"P3","fieldNames":["value0","value1","value2"],"type":"Constructor","typeName":"TProduct"},"identifier":"P3"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"Nop","fieldNames":[],"type":"Constructor","typeName":"Rec"},"identifier":"Nop"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"More","fieldNames":["value0"],"type":"Constructor","typeName":"Rec"},"identifier":"More"}],"exports":["U","P3","PF","S0","S1","S2","Nop","More","CtorSameName"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestDataDeclarations1"],"modulePath":"golden/Golden/TestDataDeclarations1.purs","reExports":{},"sourceSpan":{"end":[9,31],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"constructorName":"U","fieldNames":[],"type":"Constructor","typeName":"Unit"},"identifier":"U"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S0","fieldNames":[],"type":"Constructor","typeName":"TSum"},"identifier":"S0"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S1","fieldNames":["value0"],"type":"Constructor","typeName":"TSum"},"identifier":"S1"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S2","fieldNames":["value0","value1"],"type":"Constructor","typeName":"TSum"},"identifier":"S2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"constructorName":"PF","fieldNames":["value0"],"type":"Constructor","typeName":"TProductWithFields"},"identifier":"PF"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"constructorName":"P3","fieldNames":["value0","value1","value2"],"type":"Constructor","typeName":"TProduct"},"identifier":"P3"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"Nop","fieldNames":[],"type":"Constructor","typeName":"Rec"},"identifier":"Nop"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"More","fieldNames":["value0"],"type":"Constructor","typeName":"Rec"},"identifier":"More"}],"exports":["U","P3","PF","S0","S1","S2","Nop","More","CtorSameName"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test1"],"modulePath":"golden/Golden/DataDeclarations/Test1.purs","reExports":{},"sourceSpan":{"end":[9,31],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestDataDeclarations1/golden.ir b/test/ps/output/Golden.DataDeclarations.Test1/golden.ir similarity index 71% rename from test/ps/output/Golden.TestDataDeclarations1/golden.ir rename to test/ps/output/Golden.DataDeclarations.Test1/golden.ir index d052ebe..12f0c3f 100644 --- a/test/ps/output/Golden.TestDataDeclarations1/golden.ir +++ b/test/ps/output/Golden.DataDeclarations.Test1/golden.ir @@ -2,52 +2,52 @@ UberModule { uberModuleBindings = [], uberModuleExports = [ ( Name "U", Ctor Nothing ProductType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "Unit" ) ( CtorName "U" ) [] ), ( Name "P3", Ctor Nothing ProductType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TProduct" ) ( CtorName "P3" ) [ FieldName "value0", FieldName "value1", FieldName "value2" ] ), ( Name "PF", Ctor Nothing ProductType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TProductWithFields" ) ( CtorName "PF" ) [ FieldName "value0" ] ), ( Name "S0", Ctor Nothing SumType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TSum" ) ( CtorName "S0" ) [] ), ( Name "S1", Ctor Nothing SumType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TSum" ) ( CtorName "S1" ) [ FieldName "value0" ] ), ( Name "S2", Ctor Nothing SumType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TSum" ) ( CtorName "S2" ) [ FieldName "value0", FieldName "value1" ] ), ( Name "Nop", Ctor Nothing SumType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "Rec" ) ( CtorName "Nop" ) [] ), ( Name "More", Ctor Nothing SumType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "Rec" ) ( CtorName "More" ) [ FieldName "value0" ] ), ( Name "CtorSameName", Ctor Nothing ProductType - ( ModuleName "Golden.TestDataDeclarations1" ) + ( ModuleName "Golden.DataDeclarations.Test1" ) ( TyName "TySameName" ) ( CtorName "CtorSameName" ) [] ) diff --git a/test/ps/output/Golden.TestDataDeclarations1/golden.lua b/test/ps/output/Golden.DataDeclarations.Test1/golden.lua similarity index 50% rename from test/ps/output/Golden.TestDataDeclarations1/golden.lua rename to test/ps/output/Golden.DataDeclarations.Test1/golden.lua index 94b3ccc..6838b7b 100644 --- a/test/ps/output/Golden.TestDataDeclarations1/golden.lua +++ b/test/ps/output/Golden.DataDeclarations.Test1/golden.lua @@ -1,10 +1,10 @@ return { - U = { ["$ctor"] = "Golden.TestDataDeclarations1∷Unit.U" }, + U = { ["$ctor"] = "Golden.DataDeclarations.Test1∷Unit.U" }, P3 = function(value0) return function(value1) return function(value2) return { - ["$ctor"] = "Golden.TestDataDeclarations1∷TProduct.P3", + ["$ctor"] = "Golden.DataDeclarations.Test1∷TProduct.P3", value0 = value0, value1 = value1, value2 = value2 @@ -14,34 +14,34 @@ return { end, PF = function(value0) return { - ["$ctor"] = "Golden.TestDataDeclarations1∷TProductWithFields.PF", + ["$ctor"] = "Golden.DataDeclarations.Test1∷TProductWithFields.PF", value0 = value0 } end, - S0 = { ["$ctor"] = "Golden.TestDataDeclarations1∷TSum.S0" }, + S0 = { ["$ctor"] = "Golden.DataDeclarations.Test1∷TSum.S0" }, S1 = function(value0) return { - ["$ctor"] = "Golden.TestDataDeclarations1∷TSum.S1", + ["$ctor"] = "Golden.DataDeclarations.Test1∷TSum.S1", value0 = value0 } end, S2 = function(value0) return function(value1) return { - ["$ctor"] = "Golden.TestDataDeclarations1∷TSum.S2", + ["$ctor"] = "Golden.DataDeclarations.Test1∷TSum.S2", value0 = value0, value1 = value1 } end end, - Nop = { ["$ctor"] = "Golden.TestDataDeclarations1∷Rec.Nop" }, + Nop = { ["$ctor"] = "Golden.DataDeclarations.Test1∷Rec.Nop" }, More = function(value0) return { - ["$ctor"] = "Golden.TestDataDeclarations1∷Rec.More", + ["$ctor"] = "Golden.DataDeclarations.Test1∷Rec.More", value0 = value0 } end, CtorSameName = { - ["$ctor"] = "Golden.TestDataDeclarations1∷TySameName.CtorSameName" + ["$ctor"] = "Golden.DataDeclarations.Test1∷TySameName.CtorSameName" } } diff --git a/test/ps/output/Golden.DataDeclarations.Test2/corefn.json b/test/ps/output/Golden.DataDeclarations.Test2/corefn.json new file mode 100644 index 0000000..d2e63cf --- /dev/null +++ b/test/ps/output/Golden.DataDeclarations.Test2/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,23],"start":[8,6]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test1"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test1"]}},{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,36],"start":[8,24]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test2"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,39]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"test"}],"exports":["CtorSameName","test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test2"],"modulePath":"golden/Golden/DataDeclarations/Test2.purs","reExports":{},"sourceSpan":{"end":[8,43],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestDataDeclarations2/golden.ir b/test/ps/output/Golden.DataDeclarations.Test2/golden.ir similarity index 86% rename from test/ps/output/Golden.TestDataDeclarations2/golden.ir rename to test/ps/output/Golden.DataDeclarations.Test2/golden.ir index 39f26ec..b7c27d0 100644 --- a/test/ps/output/Golden.TestDataDeclarations2/golden.ir +++ b/test/ps/output/Golden.DataDeclarations.Test2/golden.ir @@ -2,7 +2,7 @@ UberModule { uberModuleBindings = [], uberModuleExports = [ ( Name "CtorSameName", Ctor Nothing ProductType - ( ModuleName "Golden.TestDataDeclarations2" ) + ( ModuleName "Golden.DataDeclarations.Test2" ) ( TyName "TySameName" ) ( CtorName "CtorSameName" ) [] ), diff --git a/test/ps/output/Golden.TestDataDeclarations2/golden.lua b/test/ps/output/Golden.DataDeclarations.Test2/golden.lua similarity index 59% rename from test/ps/output/Golden.TestDataDeclarations2/golden.lua rename to test/ps/output/Golden.DataDeclarations.Test2/golden.lua index 8b8e11f..99c7929 100644 --- a/test/ps/output/Golden.TestDataDeclarations2/golden.lua +++ b/test/ps/output/Golden.DataDeclarations.Test2/golden.lua @@ -1,6 +1,6 @@ return { CtorSameName = { - ["$ctor"] = "Golden.TestDataDeclarations2∷TySameName.CtorSameName" + ["$ctor"] = "Golden.DataDeclarations.Test2∷TySameName.CtorSameName" }, test = function(unused1) return function(unused0) return true end end } diff --git a/test/ps/output/Golden.TestForeign/corefn.json b/test/ps/output/Golden.Foreign.Test/corefn.json similarity index 57% rename from test/ps/output/Golden.TestForeign/corefn.json rename to test/ps/output/Golden.Foreign.Test/corefn.json index cdab29a..49ef4a9 100644 --- a/test/ps/output/Golden.TestForeign/corefn.json +++ b/test/ps/output/Golden.Foreign.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["foo"],"foreign":["foo"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,26],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestForeign"],"modulePath":"golden/Golden/TestForeign.purs","reExports":{},"sourceSpan":{"end":[3,26],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["foo"],"foreign":["foo"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,26],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Foreign","Test"],"modulePath":"golden/Golden/Foreign/Test.purs","reExports":{},"sourceSpan":{"end":[3,26],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestForeign/golden.ir b/test/ps/output/Golden.Foreign.Test/golden.ir similarity index 72% rename from test/ps/output/Golden.TestForeign/golden.ir rename to test/ps/output/Golden.Foreign.Test/golden.ir index bdf373d..8ea30a0 100644 --- a/test/ps/output/Golden.TestForeign/golden.ir +++ b/test/ps/output/Golden.Foreign.Test/golden.ir @@ -3,7 +3,7 @@ UberModule [ ( Name "foo", ObjectProp Nothing ( ForeignImport Nothing - ( ModuleName "Golden.TestForeign" ) "golden/Golden/TestForeign.purs" + ( ModuleName "Golden.Foreign.Test" ) "golden/Golden/Foreign/Test.purs" [ Name "foo" ] ) ( PropName "foo" ) diff --git a/test/ps/output/Golden.TestForeign/golden.lua b/test/ps/output/Golden.Foreign.Test/golden.lua similarity index 100% rename from test/ps/output/Golden.TestForeign/golden.lua rename to test/ps/output/Golden.Foreign.Test/golden.lua diff --git a/test/ps/output/Golden.TestHelloPrelude/corefn.json b/test/ps/output/Golden.HelloPrelude.Test/corefn.json similarity index 87% rename from test/ps/output/Golden.TestHelloPrelude/corefn.json rename to test/ps/output/Golden.HelloPrelude.Test/corefn.json index c976bfb..0b2a140 100644 --- a/test/ps/output/Golden.TestHelloPrelude/corefn.json +++ b/test/ps/output/Golden.HelloPrelude.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"type":"Var","value":{"identifier":"pass","moduleName":["Prelude"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestHelloPrelude"],"modulePath":"golden/Golden/TestHelloPrelude.purs","reExports":{},"sourceSpan":{"end":[7,12],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"type":"Var","value":{"identifier":"pass","moduleName":["Prelude"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","HelloPrelude","Test"],"modulePath":"golden/Golden/HelloPrelude/Test.purs","reExports":{},"sourceSpan":{"end":[7,12],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestHelloPrelude/golden.ir b/test/ps/output/Golden.HelloPrelude.Test/golden.ir similarity index 84% rename from test/ps/output/Golden.TestHelloPrelude/golden.ir rename to test/ps/output/Golden.HelloPrelude.Test/golden.ir index 0080a05..210a9be 100644 --- a/test/ps/output/Golden.TestHelloPrelude/golden.ir +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.ir @@ -78,42 +78,33 @@ UberModule ( ParamNamed Nothing ( Name "dictApplicative" ) ) ( Abs Nothing ( ParamNamed Nothing ( Name "f" ) ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing ( App Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) + ( PropName "apply" ) + ) + ) ( App Nothing - ( App Nothing - ( Abs Nothing - ( ParamNamed Nothing ( Name "dict" ) ) - ( ObjectProp Nothing - ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) - ( PropName "apply" ) - ) - ) - ( App Nothing - ( ObjectProp Nothing - ( Ref Nothing ( Local ( Name "dictApplicative" ) ) 0 ) - ( PropName "Apply0" ) - ) - ( Ref Nothing - ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 - ) - ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictApplicative" ) ) 0 ) + ( PropName "Apply0" ) ) - ( App Nothing - ( App Nothing - ( Ref Nothing - ( Imported - ( ModuleName "Control.Applicative" ) - ( Name "pure" ) - ) 0 - ) - ( Ref Nothing ( Local ( Name "dictApplicative" ) ) 0 ) - ) - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictApplicative" ) ) 0 ) ) - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) ) ) ) diff --git a/test/ps/output/Golden.TestHelloPrelude/golden.lua b/test/ps/output/Golden.HelloPrelude.Test/golden.lua similarity index 93% rename from test/ps/output/Golden.TestHelloPrelude/golden.lua rename to test/ps/output/Golden.HelloPrelude.Test/golden.lua index 6df06ab..3112c8a 100644 --- a/test/ps/output/Golden.TestHelloPrelude/golden.lua +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.lua @@ -90,11 +90,9 @@ Effect_I__S___lazy_functorEffect = _S___runtime_lazy("functorEffect")(function( return { map = (function(dictApplicative) return function(f) - return function(a) - return (function(dict) - return dict.apply - end)(dictApplicative.Apply0(Prim_I_undefined))(Control_Applicative_I_pure(dictApplicative)(f))(a) - end + return (function(dict) + return dict.apply + end)(dictApplicative.Apply0(Prim_I_undefined))(Control_Applicative_I_pure(dictApplicative)(f)) end end)(Effect_I_applicativeEffect) } diff --git a/test/ps/output/Golden.TestInline/corefn.json b/test/ps/output/Golden.Inline.Test/corefn.json similarity index 90% rename from test/ps/output/Golden.TestInline/corefn.json rename to test/ps/output/Golden.Inline.Test/corefn.json index 05953fe..36ae11a 100644 --- a/test/ps/output/Golden.TestInline/corefn.json +++ b/test/ps/output/Golden.Inline.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,14],"start":[6,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[7,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[7,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestInline"],"modulePath":"golden/Golden/TestInline.purs","reExports":{},"sourceSpan":{"end":[9,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,14],"start":[6,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[7,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[7,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Inline","Test"],"modulePath":"golden/Golden/Inline/Test.purs","reExports":{},"sourceSpan":{"end":[9,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Inline.Test/golden.ir b/test/ps/output/Golden.Inline.Test/golden.ir new file mode 100644 index 0000000..a9a0a66 --- /dev/null +++ b/test/ps/output/Golden.Inline.Test/golden.ir @@ -0,0 +1,2 @@ +UberModule + { uberModuleBindings = [], uberModuleExports = [ ( Name "main", LiteralInt Nothing 1 ) ] } \ No newline at end of file diff --git a/test/ps/output/Golden.Inline.Test/golden.lua b/test/ps/output/Golden.Inline.Test/golden.lua new file mode 100644 index 0000000..2764a01 --- /dev/null +++ b/test/ps/output/Golden.Inline.Test/golden.lua @@ -0,0 +1 @@ +return { main = 1 } diff --git a/test/ps/output/Golden.NameShadowing.Test/corefn.json b/test/ps/output/Golden.NameShadowing.Test/corefn.json new file mode 100644 index 0000000..a100b7a --- /dev/null +++ b/test/ps/output/Golden.NameShadowing.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,6],"start":[13,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,4],"start":[15,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,12]}},"argument":"y","body":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,18]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,25],"start":[10,24]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,26]}},"type":"Var","value":{"identifier":"x1","sourcePos":[10,19]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[10,13]}},"type":"App"},"type":"Abs"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,6]}},"type":"App"},"type":"Abs"},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,14],"start":[7,13]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,17]}},"type":"Var","value":{"identifier":"x1","sourcePos":[7,1]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,27],"start":[7,10]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,22]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"b"}],"exports":["b","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Golden","NameShadowing","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","NameShadowing","Test"],"modulePath":"golden/Golden/NameShadowing/Test.purs","reExports":{},"sourceSpan":{"end":[15,10],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestNameShadowing/golden.ir b/test/ps/output/Golden.NameShadowing.Test/golden.ir similarity index 60% rename from test/ps/output/Golden.TestNameShadowing/golden.ir rename to test/ps/output/Golden.NameShadowing.Test/golden.ir index 5edc19e..b7b8535 100644 --- a/test/ps/output/Golden.TestNameShadowing/golden.ir +++ b/test/ps/output/Golden.NameShadowing.Test/golden.ir @@ -2,7 +2,7 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestNameShadowing", qnameName = Name "f" + { qnameModuleName = ModuleName "Golden.NameShadowing.Test", qnameName = Name "f" }, Abs Nothing ( ParamNamed Nothing ( Name "v" ) ) ( Abs Nothing @@ -26,11 +26,13 @@ UberModule ( ParamNamed Nothing ( Name "x1" ) ) ( App Nothing ( App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestNameShadowing" ) ( Name "f" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 + ) ( App Nothing ( App Nothing ( Ref Nothing - ( Imported ( ModuleName "Golden.TestNameShadowing" ) ( Name "f" ) ) 0 + ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 ) ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) @@ -43,7 +45,7 @@ UberModule ( App Nothing ( App Nothing ( Ref Nothing - ( Imported ( ModuleName "Golden.TestNameShadowing" ) ( Name "f" ) ) 0 + ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 ) ( Ref Nothing ( Local ( Name "x2" ) ) 0 ) ) @@ -55,26 +57,8 @@ UberModule ) ) ), - ( Name "c", Abs Nothing - ( ParamNamed Nothing ( Name "x" ) ) - ( App Nothing - ( Abs Nothing - ( ParamNamed Nothing ( Name "y" ) ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "x1" ) ) - ( App Nothing - ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Golden.TestNameShadowing" ) ( Name "f" ) ) 0 - ) - ( Ref Nothing ( Local ( Name "x1" ) ) 0 ) - ) - ( Ref Nothing ( Local ( Name "y" ) ) 0 ) - ) - ) - ) - ( Ref Nothing ( Local ( Name "x" ) ) 0 ) - ) + ( Name "c", Ref Nothing + ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 ) ] } \ No newline at end of file diff --git a/test/ps/output/Golden.NameShadowing.Test/golden.lua b/test/ps/output/Golden.NameShadowing.Test/golden.lua new file mode 100644 index 0000000..e4e719f --- /dev/null +++ b/test/ps/output/Golden.NameShadowing.Test/golden.lua @@ -0,0 +1,19 @@ +local Golden_NameShadowing_Test_I_f = function(v) + return function(v1) + if 1 == v then + return 1 + else + return (function() if 1 == v1 then return 2 else return 3 end end)() + end + end +end +return { + b = function(x) + return function(x1) + return Golden_NameShadowing_Test_I_f(Golden_NameShadowing_Test_I_f(x)(x1))((function( x2 ) + return Golden_NameShadowing_Test_I_f(x2)(1) + end)(42)) + end + end, + c = Golden_NameShadowing_Test_I_f +} diff --git a/test/ps/output/Golden.Newtype.Test/corefn.json b/test/ps/output/Golden.Newtype.Test/corefn.json new file mode 100644 index 0000000..c616e48 --- /dev/null +++ b/test/ps/output/Golden.Newtype.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[3,31],"start":[3,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"NT"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[9,7],"start":[9,5]}},"type":"Var","value":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[6,8],"start":[6,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"binderType":"VarBinder","identifier":"n"}],"constructorName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]},"typeName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,12]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"n","sourcePos":[6,7]}},"fieldName":"foo","type":"Accessor"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"}],"exports":["NT","f","g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Golden","Newtype","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Newtype","Test"],"modulePath":"golden/Golden/Newtype/Test.purs","reExports":{},"sourceSpan":{"end":[9,7],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestNewtype/golden.ir b/test/ps/output/Golden.Newtype.Test/golden.ir similarity index 56% rename from test/ps/output/Golden.TestNewtype/golden.ir rename to test/ps/output/Golden.Newtype.Test/golden.ir index 4b9fa59..1295d7e 100644 --- a/test/ps/output/Golden.TestNewtype/golden.ir +++ b/test/ps/output/Golden.Newtype.Test/golden.ir @@ -2,17 +2,17 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestNewtype", qnameName = Name "NT" }, Abs Nothing + { qnameModuleName = ModuleName "Golden.Newtype.Test", qnameName = Name "NT" }, Abs Nothing ( ParamNamed Nothing ( Name "x" ) ) ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) ], uberModuleExports = [ - ( Name "NT", Ref Nothing ( Imported ( ModuleName "Golden.TestNewtype" ) ( Name "NT" ) ) 0 ), + ( Name "NT", Ref Nothing ( Imported ( ModuleName "Golden.Newtype.Test" ) ( Name "NT" ) ) 0 ), ( Name "f", Abs Nothing ( ParamNamed Nothing ( Name "v" ) ) ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "foo" ) ) ), - ( Name "g", Ref Nothing ( Imported ( ModuleName "Golden.TestNewtype" ) ( Name "NT" ) ) 0 ) + ( Name "g", Ref Nothing ( Imported ( ModuleName "Golden.Newtype.Test" ) ( Name "NT" ) ) 0 ) ] } \ No newline at end of file diff --git a/test/ps/output/Golden.Newtype.Test/golden.lua b/test/ps/output/Golden.Newtype.Test/golden.lua new file mode 100644 index 0000000..1ef2108 --- /dev/null +++ b/test/ps/output/Golden.Newtype.Test/golden.lua @@ -0,0 +1,6 @@ +local Golden_Newtype_Test_I_NT = function(x) return x end +return { + NT = Golden_Newtype_Test_I_NT, + f = function(v) return v.foo end, + g = Golden_Newtype_Test_I_NT +} diff --git a/test/ps/output/Golden.PatternMatching.Test1/corefn.json b/test/ps/output/Golden.PatternMatching.Test1/corefn.json new file mode 100644 index 0000000..032ce53 --- /dev/null +++ b/test/ps/output/Golden.PatternMatching.Test1/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"constructorName":"T","fieldNames":["value0","value1"],"type":"Constructor","typeName":"Tuple"},"identifier":"T"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Num","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Num"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Not","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Not"},{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,11],"start":[21,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,9],"start":[21,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,11],"start":[21,10]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[21,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"snd"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[7,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,21],"start":[8,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,20],"start":[8,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,19],"start":[8,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,19],"start":[8,18]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,17],"start":[9,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,27],"start":[10,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,26],"start":[10,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,25],"start":[10,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,24],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,24],"start":[10,23]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,15],"start":[11,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,14],"start":[11,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,8],"start":[12,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,7]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,13],"start":[12,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[7,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,11],"start":[18,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"VarBinder","identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,11],"start":[18,10]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[18,8]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fst"}],"exports":["Zero","Succ","Num","Not","pat","T","fst","snd"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test1"],"modulePath":"golden/Golden/PatternMatching/Test1.purs","reExports":{},"sourceSpan":{"end":[21,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestPatternMatching1/golden.ir b/test/ps/output/Golden.PatternMatching.Test1/golden.ir similarity index 82% rename from test/ps/output/Golden.TestPatternMatching1/golden.ir rename to test/ps/output/Golden.PatternMatching.Test1/golden.ir index 275ea36..17c66c3 100644 --- a/test/ps/output/Golden.TestPatternMatching1/golden.ir +++ b/test/ps/output/Golden.PatternMatching.Test1/golden.ir @@ -2,24 +2,24 @@ UberModule { uberModuleBindings = [], uberModuleExports = [ ( Name "Zero", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching1" ) + ( ModuleName "Golden.PatternMatching.Test1" ) ( TyName "N" ) ( CtorName "Zero" ) [] ), ( Name "Succ", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching1" ) + ( ModuleName "Golden.PatternMatching.Test1" ) ( TyName "N" ) ( CtorName "Succ" ) [ FieldName "value0" ] ), ( Name "Num", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching1" ) + ( ModuleName "Golden.PatternMatching.Test1" ) ( TyName "E" ) ( CtorName "Num" ) [ FieldName "value0" ] ), ( Name "Not", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching1" ) + ( ModuleName "Golden.PatternMatching.Test1" ) ( TyName "E" ) ( CtorName "Not" ) [ FieldName "value0" ] @@ -28,12 +28,12 @@ UberModule ( ParamNamed Nothing ( Name "e" ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷E.Not" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷E.Not" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷E.Num" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷E.Num" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -43,7 +43,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Succ" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Succ" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( ObjectProp Nothing @@ -57,7 +57,7 @@ UberModule ( LiteralInt Nothing 1 ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Zero" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Zero" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( ObjectProp Nothing @@ -74,7 +74,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷E.Not" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷E.Not" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -84,7 +84,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷E.Num" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷E.Num" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( ObjectProp Nothing @@ -97,7 +97,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Succ" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Succ" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( ObjectProp Nothing @@ -121,12 +121,12 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷E.Num" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷E.Num" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Succ" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Succ" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -142,7 +142,7 @@ UberModule ) ), ( Name "T", Ctor Nothing ProductType - ( ModuleName "Golden.TestPatternMatching1" ) + ( ModuleName "Golden.PatternMatching.Test1" ) ( TyName "Tuple" ) ( CtorName "T" ) [ FieldName "value0", FieldName "value1" ] diff --git a/test/ps/output/Golden.TestPatternMatching1/golden.lua b/test/ps/output/Golden.PatternMatching.Test1/golden.lua similarity index 55% rename from test/ps/output/Golden.TestPatternMatching1/golden.lua rename to test/ps/output/Golden.PatternMatching.Test1/golden.lua index 963b894..c5eda84 100644 --- a/test/ps/output/Golden.TestPatternMatching1/golden.lua +++ b/test/ps/output/Golden.PatternMatching.Test1/golden.lua @@ -1,24 +1,27 @@ return { - Zero = { ["$ctor"] = "Golden.TestPatternMatching1∷N.Zero" }, + Zero = { ["$ctor"] = "Golden.PatternMatching.Test1∷N.Zero" }, Succ = function(value0) - return { ["$ctor"] = "Golden.TestPatternMatching1∷N.Succ", value0 = value0 } + return { + ["$ctor"] = "Golden.PatternMatching.Test1∷N.Succ", + value0 = value0 + } end, Num = function(value0) - return { ["$ctor"] = "Golden.TestPatternMatching1∷E.Num", value0 = value0 } + return { ["$ctor"] = "Golden.PatternMatching.Test1∷E.Num", value0 = value0 } end, Not = function(value0) - return { ["$ctor"] = "Golden.TestPatternMatching1∷E.Not", value0 = value0 } + return { ["$ctor"] = "Golden.PatternMatching.Test1∷E.Not", value0 = value0 } end, pat = function(e) - if "Golden.TestPatternMatching1∷E.Not" == e["$ctor"] then + if "Golden.PatternMatching.Test1∷E.Not" == e["$ctor"] then return (function() - if "Golden.TestPatternMatching1∷E.Num" == e.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷E.Num" == e.value0["$ctor"] then return (function() - if "Golden.TestPatternMatching1∷N.Succ" == e.value0.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷N.Succ" == e.value0.value0["$ctor"] then return 1 else return (function() - if "Golden.TestPatternMatching1∷N.Zero" == e.value0.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷N.Zero" == e.value0.value0["$ctor"] then return 2 else return 6 @@ -28,11 +31,11 @@ return { end)() else return (function() - if "Golden.TestPatternMatching1∷E.Not" == e.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷E.Not" == e.value0["$ctor"] then return (function() - if "Golden.TestPatternMatching1∷E.Num" == e.value0.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷E.Num" == e.value0.value0["$ctor"] then return (function() - if "Golden.TestPatternMatching1∷N.Succ" == e.value0.value0.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷N.Succ" == e.value0.value0.value0["$ctor"] then return 3 else return 6 @@ -50,9 +53,9 @@ return { end)() else return (function() - if "Golden.TestPatternMatching1∷E.Num" == e["$ctor"] then + if "Golden.PatternMatching.Test1∷E.Num" == e["$ctor"] then return (function() - if "Golden.TestPatternMatching1∷N.Succ" == e.value0["$ctor"] then + if "Golden.PatternMatching.Test1∷N.Succ" == e.value0["$ctor"] then return 4 else return 5 @@ -67,7 +70,7 @@ return { T = function(value0) return function(value1) return { - ["$ctor"] = "Golden.TestPatternMatching1∷Tuple.T", + ["$ctor"] = "Golden.PatternMatching.Test1∷Tuple.T", value0 = value0, value1 = value1 } diff --git a/test/ps/output/Golden.PatternMatching.Test2/corefn.json b/test/ps/output/Golden.PatternMatching.Test2/corefn.json new file mode 100644 index 0000000..b383924 --- /dev/null +++ b/test/ps/output/Golden.PatternMatching.Test2/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Add","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Add"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Mul","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[8,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,16],"start":[9,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,28],"start":[9,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,16],"start":[10,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,14],"start":[10,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,16],"start":[10,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,28],"start":[10,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,19],"start":[11,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,9],"start":[11,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,18],"start":[11,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,16],"start":[11,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,19],"start":[12,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,9],"start":[12,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,18],"start":[12,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,18],"start":[12,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,25],"start":[12,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,10]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[14,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[8,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[17,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,9],"start":[18,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,11],"start":[19,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,10]}},"binderType":"VarBinder","identifier":"b"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,15]}},"type":"Var","value":{"identifier":"bat","moduleName":["Golden","PatternMatching","Test2"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,19]}},"type":"Var","value":{"identifier":"b","sourcePos":[19,10]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[17,1]}}],"type":"Case"},"type":"Abs"},"identifier":"bat"}]}],"exports":["Zero","Succ","Add","Mul","pat","bat"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test2"],"modulePath":"golden/Golden/PatternMatching/Test2.purs","reExports":{},"sourceSpan":{"end":[19,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestPatternMatching2/golden.ir b/test/ps/output/Golden.PatternMatching.Test2/golden.ir similarity index 76% rename from test/ps/output/Golden.TestPatternMatching2/golden.ir rename to test/ps/output/Golden.PatternMatching.Test2/golden.ir index 1ef54b6..0de73b1 100644 --- a/test/ps/output/Golden.TestPatternMatching2/golden.ir +++ b/test/ps/output/Golden.PatternMatching.Test2/golden.ir @@ -3,23 +3,23 @@ UberModule [ RecursiveGroup ( ( QName - { qnameModuleName = ModuleName "Golden.TestPatternMatching2", qnameName = Name "bat" + { qnameModuleName = ModuleName "Golden.PatternMatching.Test2", qnameName = Name "bat" }, Abs Nothing ( ParamNamed Nothing ( Name "n" ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Zero" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Zero" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "n" ) ) 0 ) ) ) ( LiteralInt Nothing 1 ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching1∷N.Succ" ) + ( LiteralString Nothing "Golden.PatternMatching.Test1∷N.Succ" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "n" ) ) 0 ) ) ) ( App Nothing ( Ref Nothing - ( Imported ( ModuleName "Golden.TestPatternMatching2" ) ( Name "bat" ) ) 0 + ( Imported ( ModuleName "Golden.PatternMatching.Test2" ) ( Name "bat" ) ) 0 ) ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "n" ) ) 0 ) @@ -34,24 +34,24 @@ UberModule ], uberModuleExports = [ ( Name "Zero", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching2" ) + ( ModuleName "Golden.PatternMatching.Test2" ) ( TyName "N" ) ( CtorName "Zero" ) [] ), ( Name "Succ", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching2" ) + ( ModuleName "Golden.PatternMatching.Test2" ) ( TyName "N" ) ( CtorName "Succ" ) [ FieldName "value0" ] ), ( Name "Add", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching2" ) + ( ModuleName "Golden.PatternMatching.Test2" ) ( TyName "N" ) ( CtorName "Add" ) [ FieldName "value0", FieldName "value1" ] ), ( Name "Mul", Ctor Nothing SumType - ( ModuleName "Golden.TestPatternMatching2" ) + ( ModuleName "Golden.PatternMatching.Test2" ) ( TyName "N" ) ( CtorName "Mul" ) [ FieldName "value0", FieldName "value1" ] @@ -60,12 +60,12 @@ UberModule ( ParamNamed Nothing ( Name "e" ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Add" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Add" ) ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Zero" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Zero" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -75,7 +75,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Add" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Add" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -86,7 +86,7 @@ UberModule ( LiteralInt Nothing 1 ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Mul" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Mul" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -100,7 +100,7 @@ UberModule ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Mul" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Mul" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -111,7 +111,7 @@ UberModule ( LiteralInt Nothing 3 ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Add" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Add" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -122,7 +122,7 @@ UberModule ( LiteralInt Nothing 4 ) ( IfThenElse Nothing ( Eq Nothing - ( LiteralString Nothing "Golden.TestPatternMatching2∷N.Zero" ) + ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Zero" ) ( ReflectCtor Nothing ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "e" ) ) 0 ) @@ -140,7 +140,7 @@ UberModule ) ), ( Name "bat", Ref Nothing - ( Imported ( ModuleName "Golden.TestPatternMatching2" ) ( Name "bat" ) ) 0 + ( Imported ( ModuleName "Golden.PatternMatching.Test2" ) ( Name "bat" ) ) 0 ) ] } \ No newline at end of file diff --git a/test/ps/output/Golden.TestPatternMatching2/golden.lua b/test/ps/output/Golden.PatternMatching.Test2/golden.lua similarity index 51% rename from test/ps/output/Golden.TestPatternMatching2/golden.lua rename to test/ps/output/Golden.PatternMatching.Test2/golden.lua index 8da3128..359e171 100644 --- a/test/ps/output/Golden.TestPatternMatching2/golden.lua +++ b/test/ps/output/Golden.PatternMatching.Test2/golden.lua @@ -1,11 +1,11 @@ -local Golden_TestPatternMatching2_I_bat -Golden_TestPatternMatching2_I_bat = function(n) - if "Golden.TestPatternMatching1∷N.Zero" == n["$ctor"] then +local Golden_PatternMatching_Test2_I_bat +Golden_PatternMatching_Test2_I_bat = function(n) + if "Golden.PatternMatching.Test1∷N.Zero" == n["$ctor"] then return 1 else return (function() - if "Golden.TestPatternMatching1∷N.Succ" == n["$ctor"] then - return Golden_TestPatternMatching2_I_bat(n.value0) + if "Golden.PatternMatching.Test1∷N.Succ" == n["$ctor"] then + return Golden_PatternMatching_Test2_I_bat(n.value0) else return error("No patterns matched") end @@ -13,14 +13,17 @@ Golden_TestPatternMatching2_I_bat = function(n) end end return { - Zero = { ["$ctor"] = "Golden.TestPatternMatching2∷N.Zero" }, + Zero = { ["$ctor"] = "Golden.PatternMatching.Test2∷N.Zero" }, Succ = function(value0) - return { ["$ctor"] = "Golden.TestPatternMatching2∷N.Succ", value0 = value0 } + return { + ["$ctor"] = "Golden.PatternMatching.Test2∷N.Succ", + value0 = value0 + } end, Add = function(value0) return function(value1) return { - ["$ctor"] = "Golden.TestPatternMatching2∷N.Add", + ["$ctor"] = "Golden.PatternMatching.Test2∷N.Add", value0 = value0, value1 = value1 } @@ -29,22 +32,22 @@ return { Mul = function(value0) return function(value1) return { - ["$ctor"] = "Golden.TestPatternMatching2∷N.Mul", + ["$ctor"] = "Golden.PatternMatching.Test2∷N.Mul", value0 = value0, value1 = value1 } end end, pat = function(e) - if "Golden.TestPatternMatching2∷N.Add" == e["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Add" == e["$ctor"] then return (function() - if "Golden.TestPatternMatching2∷N.Zero" == e.value1["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Zero" == e.value1["$ctor"] then return (function() - if "Golden.TestPatternMatching2∷N.Add" == e.value0["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Add" == e.value0["$ctor"] then return 1 else return (function() - if "Golden.TestPatternMatching2∷N.Mul" == e.value0["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Mul" == e.value0["$ctor"] then return 2 else return 5 @@ -54,15 +57,15 @@ return { end)() else return (function() - if "Golden.TestPatternMatching2∷N.Mul" == e.value1["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Mul" == e.value1["$ctor"] then return 3 else return (function() - if "Golden.TestPatternMatching2∷N.Add" == e.value1["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Add" == e.value1["$ctor"] then return 4 else return (function() - if "Golden.TestPatternMatching2∷N.Zero" == e.value1["$ctor"] then + if "Golden.PatternMatching.Test2∷N.Zero" == e.value1["$ctor"] then return 5 else return 6 @@ -78,5 +81,5 @@ return { return 6 end end, - bat = Golden_TestPatternMatching2_I_bat + bat = Golden_PatternMatching_Test2_I_bat } diff --git a/test/ps/output/Golden.RecDataDefs.Test/corefn.json b/test/ps/output/Golden.RecDataDefs.Test/corefn.json new file mode 100644 index 0000000..d0798c6 --- /dev/null +++ b/test/ps/output/Golden.RecDataDefs.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"A","fieldNames":[],"type":"Constructor","typeName":"A"},"identifier":"A"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"AB","fieldNames":["value0"],"type":"Constructor","typeName":"A"},"identifier":"AB"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"B","fieldNames":[],"type":"Constructor","typeName":"B"},"identifier":"B"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"BA","fieldNames":["value0"],"type":"Constructor","typeName":"B"},"identifier":"BA"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,6],"start":[10,5]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,8],"start":[13,6]}},"type":"Var","value":{"identifier":"AB","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ab"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,8],"start":[15,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[16,8],"start":[16,6]}},"type":"Var","value":{"identifier":"BA","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,9]}},"type":"Var","value":{"identifier":"ab","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ba"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[7,6],"start":[7,5]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"a"}],"exports":["A","AB","B","BA","a","b","ab","ba"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Golden","RecDataDefs","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecDataDefs","Test"],"modulePath":"golden/Golden/RecDataDefs/Test.purs","reExports":{},"sourceSpan":{"end":[16,11],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.RecDataDefs.Test/golden.ir b/test/ps/output/Golden.RecDataDefs.Test/golden.ir new file mode 100644 index 0000000..ea4c545 --- /dev/null +++ b/test/ps/output/Golden.RecDataDefs.Test/golden.ir @@ -0,0 +1,68 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Golden.RecDataDefs.Test", qnameName = Name "A" + }, Ctor Nothing SumType + ( ModuleName "Golden.RecDataDefs.Test" ) + ( TyName "A" ) + ( CtorName "A" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.RecDataDefs.Test", qnameName = Name "AB" + }, Ctor Nothing SumType + ( ModuleName "Golden.RecDataDefs.Test" ) + ( TyName "A" ) + ( CtorName "AB" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.RecDataDefs.Test", qnameName = Name "B" + }, Ctor Nothing SumType + ( ModuleName "Golden.RecDataDefs.Test" ) + ( TyName "B" ) + ( CtorName "B" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.RecDataDefs.Test", qnameName = Name "BA" + }, Ctor Nothing SumType + ( ModuleName "Golden.RecDataDefs.Test" ) + ( TyName "B" ) + ( CtorName "BA" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.RecDataDefs.Test", qnameName = Name "ab" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "AB" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "B" ) ) 0 ) + ) + ], uberModuleExports = + [ + ( Name "A", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "A" ) ) 0 + ), + ( Name "AB", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "AB" ) ) 0 + ), + ( Name "B", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "B" ) ) 0 + ), + ( Name "BA", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "BA" ) ) 0 + ), + ( Name "a", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "A" ) ) 0 + ), + ( Name "b", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "B" ) ) 0 + ), + ( Name "ab", Ref Nothing + ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "ab" ) ) 0 + ), + ( Name "ba", App Nothing + ( Ref Nothing ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "BA" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.RecDataDefs.Test" ) ( Name "ab" ) ) 0 ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.RecDataDefs.Test/golden.lua b/test/ps/output/Golden.RecDataDefs.Test/golden.lua new file mode 100644 index 0000000..9e375be --- /dev/null +++ b/test/ps/output/Golden.RecDataDefs.Test/golden.lua @@ -0,0 +1,23 @@ +local Golden_RecDataDefs_Test_I_A = { + ["$ctor"] = "Golden.RecDataDefs.Test∷A.A" +} +local Golden_RecDataDefs_Test_I_AB = function(value0) + return { ["$ctor"] = "Golden.RecDataDefs.Test∷A.AB", value0 = value0 } +end +local Golden_RecDataDefs_Test_I_B = { + ["$ctor"] = "Golden.RecDataDefs.Test∷B.B" +} +local Golden_RecDataDefs_Test_I_BA = function(value0) + return { ["$ctor"] = "Golden.RecDataDefs.Test∷B.BA", value0 = value0 } +end +local Golden_RecDataDefs_Test_I_ab = Golden_RecDataDefs_Test_I_AB(Golden_RecDataDefs_Test_I_B) +return { + A = Golden_RecDataDefs_Test_I_A, + AB = Golden_RecDataDefs_Test_I_AB, + B = Golden_RecDataDefs_Test_I_B, + BA = Golden_RecDataDefs_Test_I_BA, + a = Golden_RecDataDefs_Test_I_A, + b = Golden_RecDataDefs_Test_I_B, + ab = Golden_RecDataDefs_Test_I_ab, + ba = Golden_RecDataDefs_Test_I_BA(Golden_RecDataDefs_Test_I_ab) +} diff --git a/test/ps/output/Golden.TestRecordsAccess/corefn.json b/test/ps/output/Golden.RecordsAccess.Test/corefn.json similarity index 85% rename from test/ps/output/Golden.TestRecordsAccess/corefn.json rename to test/ps/output/Golden.RecordsAccess.Test/corefn.json index c998283..b065d43 100644 --- a/test/ps/output/Golden.TestRecordsAccess/corefn.json +++ b/test/ps/output/Golden.RecordsAccess.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[18,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,8],"start":[19,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,5]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,12]}},"type":"Var","value":{"identifier":"x","sourcePos":[19,5]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,16]}},"type":"Var","value":{"identifier":"v","sourcePos":[18,1]}}],"type":"Case"},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,12],"start":[15,7]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"x","type":"Accessor"},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,7],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,22],"start":[6,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,13],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","TestRecordsAccess"]}},"fieldName":"x","type":"Accessor"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Golden","TestRecordsAccess"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestRecordsAccess"],"modulePath":"golden/Golden/TestRecordsAccess.purs","reExports":{},"sourceSpan":{"end":[19,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[18,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,8],"start":[19,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,5]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,12]}},"type":"Var","value":{"identifier":"x","sourcePos":[19,5]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,16]}},"type":"Var","value":{"identifier":"v","sourcePos":[18,1]}}],"type":"Case"},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,12],"start":[15,7]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"x","type":"Accessor"},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,7],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,22],"start":[6,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,13],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsAccess","Test"]}},"fieldName":"x","type":"Accessor"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Golden","RecordsAccess","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsAccess","Test"],"modulePath":"golden/Golden/RecordsAccess/Test.purs","reExports":{},"sourceSpan":{"end":[19,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecordsAccess/golden.ir b/test/ps/output/Golden.RecordsAccess.Test/golden.ir similarity index 77% rename from test/ps/output/Golden.TestRecordsAccess/golden.ir rename to test/ps/output/Golden.RecordsAccess.Test/golden.ir index 117b5ec..54ff69a 100644 --- a/test/ps/output/Golden.TestRecordsAccess/golden.ir +++ b/test/ps/output/Golden.RecordsAccess.Test/golden.ir @@ -2,17 +2,17 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestRecordsAccess", qnameName = Name "r" + { qnameModuleName = ModuleName "Golden.RecordsAccess.Test", qnameName = Name "r" }, LiteralObject Nothing [ ( PropName "x", LiteralInt Nothing 1 ), ( PropName "y", LiteralBool Nothing True ) ] ) ], uberModuleExports = [ ( Name "r", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecordsAccess" ) ( Name "r" ) ) 0 + ( Imported ( ModuleName "Golden.RecordsAccess.Test" ) ( Name "r" ) ) 0 ), ( Name "test1", ObjectProp Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecordsAccess" ) ( Name "r" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.RecordsAccess.Test" ) ( Name "r" ) ) 0 ) ( PropName "x" ) ), ( Name "test2", Abs Nothing diff --git a/test/ps/output/Golden.RecordsAccess.Test/golden.lua b/test/ps/output/Golden.RecordsAccess.Test/golden.lua new file mode 100644 index 0000000..a39b2ee --- /dev/null +++ b/test/ps/output/Golden.RecordsAccess.Test/golden.lua @@ -0,0 +1,8 @@ +local Golden_RecordsAccess_Test_I_r = { x = 1, y = true } +return { + r = Golden_RecordsAccess_Test_I_r, + test1 = Golden_RecordsAccess_Test_I_r.x, + test2 = function(v) return v.x end, + test3 = function(v) return v.x end, + test4 = function(v) return v.x end +} diff --git a/test/ps/output/Golden.TestRecordsUpdate/corefn.json b/test/ps/output/Golden.RecordsUpdate.Test/corefn.json similarity index 79% rename from test/ps/output/Golden.TestRecordsUpdate/corefn.json rename to test/ps/output/Golden.RecordsUpdate.Test/corefn.json index 1a07d01..41b38b2 100644 --- a/test/ps/output/Golden.TestRecordsUpdate/corefn.json +++ b/test/ps/output/Golden.RecordsUpdate.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,36],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"copy":null,"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[21,18],"start":[21,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["x","y"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"z","type":"Accessor"},"type":"ObjectUpdate","updates":[["p",{"annotation":{"meta":null,"sourceSpan":{"end":[16,24],"start":[16,21]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}}]]}]]},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"copy":["x","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["y",{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[13,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}]]},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,47],"start":[7,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}],["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,25]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,30]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"foo"}}],["p",{"annotation":{"meta":null,"sourceSpan":{"end":[7,43],"start":[7,40]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"a"}}]]}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,10],"start":[10,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","TestRecordsUpdate"]}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"copy":["y","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[10,1]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[10,18],"start":[10,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}}]]},"type":"Let"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Golden","TestRecordsUpdate"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestRecordsUpdate"],"modulePath":"golden/Golden/TestRecordsUpdate.purs","reExports":{},"sourceSpan":{"end":[21,20],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,36],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"copy":null,"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[21,18],"start":[21,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["x","y"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"z","type":"Accessor"},"type":"ObjectUpdate","updates":[["p",{"annotation":{"meta":null,"sourceSpan":{"end":[16,24],"start":[16,21]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}}]]}]]},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"copy":["x","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["y",{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[13,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}]]},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,47],"start":[7,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}],["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,25]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,30]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"foo"}}],["p",{"annotation":{"meta":null,"sourceSpan":{"end":[7,43],"start":[7,40]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"a"}}]]}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,10],"start":[10,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsUpdate","Test"]}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"copy":["y","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[10,1]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[10,18],"start":[10,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}}]]},"type":"Let"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Golden","RecordsUpdate","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsUpdate","Test"],"modulePath":"golden/Golden/RecordsUpdate/Test.purs","reExports":{},"sourceSpan":{"end":[21,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecordsUpdate/golden.ir b/test/ps/output/Golden.RecordsUpdate.Test/golden.ir similarity index 85% rename from test/ps/output/Golden.TestRecordsUpdate/golden.ir rename to test/ps/output/Golden.RecordsUpdate.Test/golden.ir index 615904a..731fd6c 100644 --- a/test/ps/output/Golden.TestRecordsUpdate/golden.ir +++ b/test/ps/output/Golden.RecordsUpdate.Test/golden.ir @@ -2,7 +2,7 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestRecordsUpdate", qnameName = Name "r" + { qnameModuleName = ModuleName "Golden.RecordsUpdate.Test", qnameName = Name "r" }, LiteralObject Nothing [ ( PropName "x", LiteralInt Nothing 1 ), @@ -18,10 +18,10 @@ UberModule ], uberModuleExports = [ ( Name "r", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecordsUpdate" ) ( Name "r" ) ) 0 + ( Imported ( ModuleName "Golden.RecordsUpdate.Test" ) ( Name "r" ) ) 0 ), ( Name "test1", ObjectUpdate Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecordsUpdate" ) ( Name "r" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.RecordsUpdate.Test" ) ( Name "r" ) ) 0 ) ( ( PropName "x", LiteralInt Nothing 2 ) :| [] ) ), ( Name "test2", Abs Nothing diff --git a/test/ps/output/Golden.TestRecordsUpdate/golden.lua b/test/ps/output/Golden.RecordsUpdate.Test/golden.lua similarity index 78% rename from test/ps/output/Golden.TestRecordsUpdate/golden.lua rename to test/ps/output/Golden.RecordsUpdate.Test/golden.lua index 78565b2..433ec37 100644 --- a/test/ps/output/Golden.TestRecordsUpdate/golden.lua +++ b/test/ps/output/Golden.RecordsUpdate.Test/golden.lua @@ -10,14 +10,14 @@ local function _S___object_update(o, patches) end return o_copy end -local Golden_TestRecordsUpdate_I_r = { +local Golden_RecordsUpdate_Test_I_r = { x = 1, y = true, z = { z = "foo", p = "a" } } return { - r = Golden_TestRecordsUpdate_I_r, - test1 = _S___object_update(Golden_TestRecordsUpdate_I_r, { x = 2 }), + r = Golden_RecordsUpdate_Test_I_r, + test1 = _S___object_update(Golden_RecordsUpdate_Test_I_r, { x = 2 }), test2 = function(v) return _S___object_update(v, { y = false }) end, test3 = function(v) return _S___object_update(v, { z = _S___object_update(v.z, { p = "b" }) }) diff --git a/test/ps/output/Golden.TestRecursiveBindings/corefn.json b/test/ps/output/Golden.RecursiveBindings.Test/corefn.json similarity index 98% rename from test/ps/output/Golden.TestRecursiveBindings/corefn.json rename to test/ps/output/Golden.RecursiveBindings.Test/corefn.json index 1c395f8..0a7a833 100644 --- a/test/ps/output/Golden.TestRecursiveBindings/corefn.json +++ b/test/ps/output/Golden.RecursiveBindings.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[19,20],"start":[19,12]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,28],"start":[26,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[28,9],"start":[28,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,15],"start":[28,13]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[29,10],"start":[29,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[29,16],"start":[29,14]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,27],"start":[21,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,9],"start":[23,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,16],"start":[23,13]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,10],"start":[24,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,14]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,12]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"whereRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[33,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"z"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,12],"start":[42,11]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,12],"start":[41,11]}},"type":"Var","value":{"identifier":"b","sourcePos":[42,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"a"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"k","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[35,14],"start":[35,13]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,15]}},"type":"Var","value":{"identifier":"k","sourcePos":[35,5]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,13],"start":[38,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,10],"start":[38,9]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,15]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[37,13],"start":[37,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,10],"start":[37,9]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"identifier":"x"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,9],"start":[54,8]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,6],"start":[54,5]}},"type":"Var","value":{"identifier":"x","sourcePos":[37,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,16],"start":[54,15]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,13],"start":[54,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"letRecMixed"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[5,3]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,15]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,12],"start":[14,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,16]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,11],"start":[8,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,15]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,19],"start":[9,16]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,20]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[16,7],"start":[16,5]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,8]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"letRec"}],"exports":["letRec","whereRec","letRecMixed"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestRecursiveBindings"],"modulePath":"golden/Golden/TestRecursiveBindings.purs","reExports":{},"sourceSpan":{"end":[54,20],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[19,20],"start":[19,12]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,28],"start":[26,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[28,9],"start":[28,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,15],"start":[28,13]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[29,10],"start":[29,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[29,16],"start":[29,14]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,27],"start":[21,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,9],"start":[23,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,16],"start":[23,13]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,10],"start":[24,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,14]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,12]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"whereRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[33,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"z"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,12],"start":[42,11]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,12],"start":[41,11]}},"type":"Var","value":{"identifier":"b","sourcePos":[42,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"a"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"k","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[35,14],"start":[35,13]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,15]}},"type":"Var","value":{"identifier":"k","sourcePos":[35,5]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,13],"start":[38,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,10],"start":[38,9]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,15]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[37,13],"start":[37,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,10],"start":[37,9]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"identifier":"x"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,9],"start":[54,8]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,6],"start":[54,5]}},"type":"Var","value":{"identifier":"x","sourcePos":[37,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,16],"start":[54,15]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,13],"start":[54,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"letRecMixed"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[5,3]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,15]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,12],"start":[14,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,16]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,11],"start":[8,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,15]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,19],"start":[9,16]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,20]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[16,7],"start":[16,5]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,8]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"letRec"}],"exports":["letRec","whereRec","letRecMixed"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecursiveBindings","Test"],"modulePath":"golden/Golden/RecursiveBindings/Test.purs","reExports":{},"sourceSpan":{"end":[54,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecursiveBindings/golden.ir b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir similarity index 86% rename from test/ps/output/Golden.TestRecursiveBindings/golden.ir rename to test/ps/output/Golden.RecursiveBindings.Test/golden.ir index f78c88a..9c5beb6 100644 --- a/test/ps/output/Golden.TestRecursiveBindings/golden.ir +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir @@ -104,29 +104,11 @@ UberModule ( Nothing, Name "z", LiteralInt Nothing 1 ) :| [ RecursiveGroup ( - ( Nothing, Name "a", Abs Nothing ( ParamUnused Nothing ) - ( App Nothing - ( Ref Nothing ( Local ( Name "b" ) ) 0 ) - ( Ref Nothing ( Local ( Name "z" ) ) 0 ) - ) - ) :| - [ - ( Nothing, Name "b", Abs Nothing ( ParamUnused Nothing ) - ( App Nothing - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) - ( Ref Nothing ( Local ( Name "z" ) ) 0 ) - ) - ) - ] + ( Nothing, Name "a", Ref Nothing ( Local ( Name "b" ) ) 0 ) :| + [ ( Nothing, Name "b", Ref Nothing ( Local ( Name "a" ) ) 0 ) ] ), Standalone ( Nothing, Name "f", Abs Nothing ( ParamUnused Nothing ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "k" ) ) - ( App Nothing - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) - ( Ref Nothing ( Local ( Name "k" ) ) 0 ) - ) - ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) ), Standalone ( Nothing, Name "y", App Nothing ( App Nothing diff --git a/test/ps/output/Golden.TestRecursiveBindings/golden.lua b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua similarity index 90% rename from test/ps/output/Golden.TestRecursiveBindings/golden.lua rename to test/ps/output/Golden.RecursiveBindings.Test/golden.lua index 2df347d..5d32b29 100644 --- a/test/ps/output/Golden.TestRecursiveBindings/golden.lua +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua @@ -65,9 +65,9 @@ return { local z = 1 local a local b - a = function(unused0) return b(z) end - b = function(unused1) return a(z) end - local f = function(unused2) return function(k) return a(k) end end + a = b + b = a + local f = function(unused0) return a end local y = f(z)(z) return f(f(y)(y))(f(y)(0)) end)() diff --git a/test/ps/output/Golden.TestReexport/corefn.json b/test/ps/output/Golden.Reexport.Test/corefn.json similarity index 84% rename from test/ps/output/Golden.TestReexport/corefn.json rename to test/ps/output/Golden.Reexport.Test/corefn.json index e0ea576..c828c75 100644 --- a/test/ps/output/Golden.TestReexport/corefn.json +++ b/test/ps/output/Golden.Reexport.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,22],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[6,12]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,22],"start":[6,14]}},"type":"Var","value":{"identifier":"binding1","moduleName":["Golden","Reexport","Exports"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,33],"start":[6,25]}},"type":"Var","value":{"identifier":"binding2","moduleName":["Golden","Reexport","ReExports"]}}]}},"identifier":"binding3"}],"exports":["binding3"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","ReExports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestReexport"],"modulePath":"golden/Golden/TestReexport.purs","reExports":{},"sourceSpan":{"end":[6,35],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,22],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[6,12]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,22],"start":[6,14]}},"type":"Var","value":{"identifier":"binding1","moduleName":["Golden","Reexport","Exports"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,33],"start":[6,25]}},"type":"Var","value":{"identifier":"binding2","moduleName":["Golden","Reexport","ReExports"]}}]}},"identifier":"binding3"}],"exports":["binding3"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","ReExports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","Test"],"modulePath":"golden/Golden/Reexport/Test.purs","reExports":{},"sourceSpan":{"end":[6,35],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestReexport/golden.ir b/test/ps/output/Golden.Reexport.Test/golden.ir similarity index 100% rename from test/ps/output/Golden.TestReexport/golden.ir rename to test/ps/output/Golden.Reexport.Test/golden.ir diff --git a/test/ps/output/Golden.TestReexport/golden.lua b/test/ps/output/Golden.Reexport.Test/golden.lua similarity index 100% rename from test/ps/output/Golden.TestReexport/golden.lua rename to test/ps/output/Golden.Reexport.Test/golden.lua diff --git a/test/ps/output/Golden.TestCaseStatements/corefn.json b/test/ps/output/Golden.TestCaseStatements/corefn.json deleted file mode 100644 index c7c0db4..0000000 --- a/test/ps/output/Golden.TestCaseStatements/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"J","fieldNames":["value0"],"type":"Constructor","typeName":"M"},"identifier":"J"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"N","fieldNames":[],"type":"Constructor","typeName":"M"},"identifier":"N"},{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"caseAlternatives":[{"binders":[],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[59,14],"start":[59,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[59,10],"start":[59,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}},{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[60,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[60,9],"start":[60,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}}],"isGuarded":true}],"caseExpressions":[],"type":"Case"},"identifier":"multipleGuards"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,8],"start":[42,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"y"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,13],"start":[42,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,6],"start":[43,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[43,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,8],"start":[41,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"x"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,14],"start":[41,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"J","moduleName":["Golden","TestCaseStatements"]},"typeName":{"identifier":"M","moduleName":["Golden","TestCaseStatements"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,22],"start":[41,21]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"N","moduleName":["Golden","TestCaseStatements"]},"typeName":{"identifier":"M","moduleName":["Golden","TestCaseStatements"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,31]}},"type":"Var","value":{"identifier":"y","sourcePos":[41,13]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,26]}},"type":"Var","value":{"identifier":"n","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,19],"start":[41,18]}},"type":"Var","value":{"identifier":"m","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Let"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"d"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,9],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,8],"start":[9,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,9],"start":[15,8]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,21],"start":[15,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,13],"start":[15,12]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestValues"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,12],"start":[16,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":3}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,15],"start":[16,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,26],"start":[16,25]}},"type":"Var","value":{"identifier":"y","sourcePos":[16,5]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestValues"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,20]}},"type":"Var","value":{"identifier":"z","sourcePos":[16,8]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,12],"start":[17,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":4}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,26],"start":[17,25]}},"type":"Var","value":{"identifier":"z","sourcePos":[17,8]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,19],"start":[17,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestValues"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,20]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,5]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","TestCaseStatements"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","TestCaseStatements"]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,8]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"b"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,28],"start":[14,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,19]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestValues"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,15],"start":[14,14]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestValues"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,16]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","TestCaseStatements"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","TestCaseStatements"]}}],"type":"Case"},"type":"Let"},"identifier":"c"}],"exports":["a","b","c","J","N","d","multipleGuards"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","TestCaseStatements"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","TestValues"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestCaseStatements"],"modulePath":"golden/Golden/TestCaseStatements.purs","reExports":{},"sourceSpan":{"end":[60,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestDataDeclarations2/corefn.json b/test/ps/output/Golden.TestDataDeclarations2/corefn.json deleted file mode 100644 index 958fbda..0000000 --- a/test/ps/output/Golden.TestDataDeclarations2/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,23],"start":[8,6]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","TestDataDeclarations1"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","TestDataDeclarations1"]}},{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,36],"start":[8,24]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","TestDataDeclarations2"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","TestDataDeclarations2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,39]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"test"}],"exports":["CtorSameName","test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","TestDataDeclarations1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","TestDataDeclarations2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestDataDeclarations2"],"modulePath":"golden/Golden/TestDataDeclarations2.purs","reExports":{},"sourceSpan":{"end":[8,43],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestInline/golden.ir b/test/ps/output/Golden.TestInline/golden.ir deleted file mode 100644 index a11dd8c..0000000 --- a/test/ps/output/Golden.TestInline/golden.ir +++ /dev/null @@ -1,9 +0,0 @@ -UberModule - { uberModuleBindings = [], uberModuleExports = - [ - ( Name "main", App Nothing - ( Abs Nothing ( ParamUnused Nothing ) ( LiteralInt Nothing 1 ) ) - ( Abs Nothing ( ParamUnused Nothing ) ( LiteralInt Nothing 2 ) ) - ) - ] - } \ No newline at end of file diff --git a/test/ps/output/Golden.TestInline/golden.lua b/test/ps/output/Golden.TestInline/golden.lua deleted file mode 100644 index f5a88c5..0000000 --- a/test/ps/output/Golden.TestInline/golden.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - main = (function(unused0) return 1 end)(function(unused1) return 2 end) -} diff --git a/test/ps/output/Golden.TestNameShadowing/corefn.json b/test/ps/output/Golden.TestNameShadowing/corefn.json deleted file mode 100644 index cfbfb45..0000000 --- a/test/ps/output/Golden.TestNameShadowing/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,6],"start":[13,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,4],"start":[15,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,12]}},"argument":"y","body":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,18]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,25],"start":[10,24]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestNameShadowing"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,26]}},"type":"Var","value":{"identifier":"x1","sourcePos":[10,19]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[10,13]}},"type":"App"},"type":"Abs"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,6]}},"type":"App"},"type":"Abs"},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestNameShadowing"]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestNameShadowing"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,14],"start":[7,13]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestNameShadowing"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,17]}},"type":"Var","value":{"identifier":"x1","sourcePos":[7,1]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,27],"start":[7,10]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,22]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","TestNameShadowing"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"b"}],"exports":["b","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Golden","TestNameShadowing"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestNameShadowing"],"modulePath":"golden/Golden/TestNameShadowing.purs","reExports":{},"sourceSpan":{"end":[15,10],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestNameShadowing/golden.lua b/test/ps/output/Golden.TestNameShadowing/golden.lua deleted file mode 100644 index 1d4ef59..0000000 --- a/test/ps/output/Golden.TestNameShadowing/golden.lua +++ /dev/null @@ -1,23 +0,0 @@ -local Golden_TestNameShadowing_I_f = function(v) - return function(v1) - if 1 == v then - return 1 - else - return (function() if 1 == v1 then return 2 else return 3 end end)() - end - end -end -return { - b = function(x) - return function(x1) - return Golden_TestNameShadowing_I_f(Golden_TestNameShadowing_I_f(x)(x1))((function( x2 ) - return Golden_TestNameShadowing_I_f(x2)(1) - end)(42)) - end - end, - c = function(x) - return (function(y) - return function(x1) return Golden_TestNameShadowing_I_f(x1)(y) end - end)(x) - end -} diff --git a/test/ps/output/Golden.TestNewtype/corefn.json b/test/ps/output/Golden.TestNewtype/corefn.json deleted file mode 100644 index 9300be8..0000000 --- a/test/ps/output/Golden.TestNewtype/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[3,31],"start":[3,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"NT"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[9,7],"start":[9,5]}},"type":"Var","value":{"identifier":"NT","moduleName":["Golden","TestNewtype"]}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[6,8],"start":[6,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"binderType":"VarBinder","identifier":"n"}],"constructorName":{"identifier":"NT","moduleName":["Golden","TestNewtype"]},"typeName":{"identifier":"NT","moduleName":["Golden","TestNewtype"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,12]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"n","sourcePos":[6,7]}},"fieldName":"foo","type":"Accessor"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"}],"exports":["NT","f","g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Golden","TestNewtype"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestNewtype"],"modulePath":"golden/Golden/TestNewtype.purs","reExports":{},"sourceSpan":{"end":[9,7],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestNewtype/golden.lua b/test/ps/output/Golden.TestNewtype/golden.lua deleted file mode 100644 index 4050845..0000000 --- a/test/ps/output/Golden.TestNewtype/golden.lua +++ /dev/null @@ -1,6 +0,0 @@ -local Golden_TestNewtype_I_NT = function(x) return x end -return { - NT = Golden_TestNewtype_I_NT, - f = function(v) return v.foo end, - g = Golden_TestNewtype_I_NT -} diff --git a/test/ps/output/Golden.TestPatternMatching1/corefn.json b/test/ps/output/Golden.TestPatternMatching1/corefn.json deleted file mode 100644 index 5379736..0000000 --- a/test/ps/output/Golden.TestPatternMatching1/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"constructorName":"T","fieldNames":["value0","value1"],"type":"Constructor","typeName":"Tuple"},"identifier":"T"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Num","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Num"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Not","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Not"},{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,11],"start":[21,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,9],"start":[21,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,11],"start":[21,10]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"T","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[21,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"snd"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[7,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,21],"start":[8,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,20],"start":[8,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,19],"start":[8,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,19],"start":[8,18]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,17],"start":[9,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,27],"start":[10,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,26],"start":[10,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,25],"start":[10,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,24],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,24],"start":[10,23]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,15],"start":[11,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,14],"start":[11,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,8],"start":[12,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,7]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Num","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"E","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,13],"start":[12,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[7,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,11],"start":[18,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"VarBinder","identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,11],"start":[18,10]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"T","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[18,8]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fst"}],"exports":["Zero","Succ","Num","Not","pat","T","fst","snd"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Golden","TestPatternMatching1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestPatternMatching1"],"modulePath":"golden/Golden/TestPatternMatching1.purs","reExports":{},"sourceSpan":{"end":[21,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestPatternMatching2/corefn.json b/test/ps/output/Golden.TestPatternMatching2/corefn.json deleted file mode 100644 index 2e56bc7..0000000 --- a/test/ps/output/Golden.TestPatternMatching2/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Add","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Add"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Mul","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[8,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,16],"start":[9,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,28],"start":[9,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,16],"start":[10,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,14],"start":[10,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,16],"start":[10,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,28],"start":[10,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,19],"start":[11,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,9],"start":[11,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,18],"start":[11,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,16],"start":[11,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,19],"start":[12,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,9],"start":[12,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,18],"start":[12,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,18],"start":[12,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,25],"start":[12,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,10]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","TestPatternMatching2"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[14,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[8,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[17,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,9],"start":[18,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,11],"start":[19,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,10]}},"binderType":"VarBinder","identifier":"b"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","TestPatternMatching1"]},"typeName":{"identifier":"N","moduleName":["Golden","TestPatternMatching1"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,15]}},"type":"Var","value":{"identifier":"bat","moduleName":["Golden","TestPatternMatching2"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,19]}},"type":"Var","value":{"identifier":"b","sourcePos":[19,10]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[17,1]}}],"type":"Case"},"type":"Abs"},"identifier":"bat"}]}],"exports":["Zero","Succ","Add","Mul","pat","bat"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","TestPatternMatching1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","TestPatternMatching2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestPatternMatching2"],"modulePath":"golden/Golden/TestPatternMatching2.purs","reExports":{},"sourceSpan":{"end":[19,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecDataDefs/corefn.json b/test/ps/output/Golden.TestRecDataDefs/corefn.json deleted file mode 100644 index fc4b765..0000000 --- a/test/ps/output/Golden.TestRecDataDefs/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"A","fieldNames":[],"type":"Constructor","typeName":"A"},"identifier":"A"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"AB","fieldNames":["value0"],"type":"Constructor","typeName":"A"},"identifier":"AB"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"B","fieldNames":[],"type":"Constructor","typeName":"B"},"identifier":"B"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"BA","fieldNames":["value0"],"type":"Constructor","typeName":"B"},"identifier":"BA"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,6],"start":[10,5]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","TestRecDataDefs"]}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,8],"start":[13,6]}},"type":"Var","value":{"identifier":"AB","moduleName":["Golden","TestRecDataDefs"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","TestRecDataDefs"]}},"type":"App"},"identifier":"ab"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,8],"start":[15,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[16,8],"start":[16,6]}},"type":"Var","value":{"identifier":"BA","moduleName":["Golden","TestRecDataDefs"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,9]}},"type":"Var","value":{"identifier":"ab","moduleName":["Golden","TestRecDataDefs"]}},"type":"App"},"identifier":"ba"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[7,6],"start":[7,5]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","TestRecDataDefs"]}},"identifier":"a"}],"exports":["A","AB","B","BA","a","b","ab","ba"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Golden","TestRecDataDefs"]},{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestRecDataDefs"],"modulePath":"golden/Golden/TestRecDataDefs.purs","reExports":{},"sourceSpan":{"end":[16,11],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecDataDefs/golden.ir b/test/ps/output/Golden.TestRecDataDefs/golden.ir deleted file mode 100644 index d465fde..0000000 --- a/test/ps/output/Golden.TestRecDataDefs/golden.ir +++ /dev/null @@ -1,68 +0,0 @@ -UberModule - { uberModuleBindings = - [ Standalone - ( QName - { qnameModuleName = ModuleName "Golden.TestRecDataDefs", qnameName = Name "A" - }, Ctor Nothing SumType - ( ModuleName "Golden.TestRecDataDefs" ) - ( TyName "A" ) - ( CtorName "A" ) [] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Golden.TestRecDataDefs", qnameName = Name "AB" - }, Ctor Nothing SumType - ( ModuleName "Golden.TestRecDataDefs" ) - ( TyName "A" ) - ( CtorName "AB" ) - [ FieldName "value0" ] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Golden.TestRecDataDefs", qnameName = Name "B" - }, Ctor Nothing SumType - ( ModuleName "Golden.TestRecDataDefs" ) - ( TyName "B" ) - ( CtorName "B" ) [] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Golden.TestRecDataDefs", qnameName = Name "BA" - }, Ctor Nothing SumType - ( ModuleName "Golden.TestRecDataDefs" ) - ( TyName "B" ) - ( CtorName "BA" ) - [ FieldName "value0" ] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Golden.TestRecDataDefs", qnameName = Name "ab" - }, App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "AB" ) ) 0 ) - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "B" ) ) 0 ) - ) - ], uberModuleExports = - [ - ( Name "A", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "A" ) ) 0 - ), - ( Name "AB", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "AB" ) ) 0 - ), - ( Name "B", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "B" ) ) 0 - ), - ( Name "BA", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "BA" ) ) 0 - ), - ( Name "a", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "A" ) ) 0 - ), - ( Name "b", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "B" ) ) 0 - ), - ( Name "ab", Ref Nothing - ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "ab" ) ) 0 - ), - ( Name "ba", App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "BA" ) ) 0 ) - ( Ref Nothing ( Imported ( ModuleName "Golden.TestRecDataDefs" ) ( Name "ab" ) ) 0 ) - ) - ] - } \ No newline at end of file diff --git a/test/ps/output/Golden.TestRecDataDefs/golden.lua b/test/ps/output/Golden.TestRecDataDefs/golden.lua deleted file mode 100644 index 63980bd..0000000 --- a/test/ps/output/Golden.TestRecDataDefs/golden.lua +++ /dev/null @@ -1,19 +0,0 @@ -local Golden_TestRecDataDefs_I_A = { ["$ctor"] = "Golden.TestRecDataDefs∷A.A" } -local Golden_TestRecDataDefs_I_AB = function(value0) - return { ["$ctor"] = "Golden.TestRecDataDefs∷A.AB", value0 = value0 } -end -local Golden_TestRecDataDefs_I_B = { ["$ctor"] = "Golden.TestRecDataDefs∷B.B" } -local Golden_TestRecDataDefs_I_BA = function(value0) - return { ["$ctor"] = "Golden.TestRecDataDefs∷B.BA", value0 = value0 } -end -local Golden_TestRecDataDefs_I_ab = Golden_TestRecDataDefs_I_AB(Golden_TestRecDataDefs_I_B) -return { - A = Golden_TestRecDataDefs_I_A, - AB = Golden_TestRecDataDefs_I_AB, - B = Golden_TestRecDataDefs_I_B, - BA = Golden_TestRecDataDefs_I_BA, - a = Golden_TestRecDataDefs_I_A, - b = Golden_TestRecDataDefs_I_B, - ab = Golden_TestRecDataDefs_I_ab, - ba = Golden_TestRecDataDefs_I_BA(Golden_TestRecDataDefs_I_ab) -} diff --git a/test/ps/output/Golden.TestRecordsAccess/golden.lua b/test/ps/output/Golden.TestRecordsAccess/golden.lua deleted file mode 100644 index 16c3fde..0000000 --- a/test/ps/output/Golden.TestRecordsAccess/golden.lua +++ /dev/null @@ -1,8 +0,0 @@ -local Golden_TestRecordsAccess_I_r = { x = 1, y = true } -return { - r = Golden_TestRecordsAccess_I_r, - test1 = Golden_TestRecordsAccess_I_r.x, - test2 = function(v) return v.x end, - test3 = function(v) return v.x end, - test4 = function(v) return v.x end -} diff --git a/test/ps/output/Golden.TestReturnTableField/corefn.json b/test/ps/output/Golden.TestReturnTableField/corefn.json index 829446b..a38143d 100644 --- a/test/ps/output/Golden.TestReturnTableField/corefn.json +++ b/test/ps/output/Golden.TestReturnTableField/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["u"],"foreign":["u"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,22],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestReturnTableField"],"modulePath":"golden/Golden/TestReturnTableField.purs","reExports":{},"sourceSpan":{"end":[4,22],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["u"],"foreign":["u"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,22],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestReturnTableField"],"modulePath":"golden/Golden/ReturnTableField/Test.purs","reExports":{},"sourceSpan":{"end":[4,22],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestReturnTableField/golden.ir b/test/ps/output/Golden.TestReturnTableField/golden.ir index 3e7a296..3387828 100644 --- a/test/ps/output/Golden.TestReturnTableField/golden.ir +++ b/test/ps/output/Golden.TestReturnTableField/golden.ir @@ -3,7 +3,7 @@ UberModule [ ( Name "u", ObjectProp Nothing ( ForeignImport Nothing - ( ModuleName "Golden.TestReturnTableField" ) "golden/Golden/TestReturnTableField.purs" + ( ModuleName "Golden.TestReturnTableField" ) "golden/Golden/ReturnTableField/Test.purs" [ Name "u" ] ) ( PropName "u" ) diff --git a/test/ps/output/Golden.TestUnbinding/corefn.json b/test/ps/output/Golden.TestUnbinding/corefn.json deleted file mode 100644 index c8d4eec..0000000 --- a/test/ps/output/Golden.TestUnbinding/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestUnbinding"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","TestUnbinding"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","TestUnbinding"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","TestUnbinding"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","TestUnbinding"]}},"type":"App"},"type":"App"},"identifier":"c"}],"exports":["a","b","f","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Golden","TestUnbinding"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestUnbinding"],"modulePath":"golden/Golden/TestUnbinding.purs","reExports":{},"sourceSpan":{"end":[6,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestUnbinding/golden.lua b/test/ps/output/Golden.TestUnbinding/golden.lua deleted file mode 100644 index 3f37867..0000000 --- a/test/ps/output/Golden.TestUnbinding/golden.lua +++ /dev/null @@ -1,9 +0,0 @@ -local Golden_TestUnbinding_I_f = function(unused1) - return function(unused0) return 3 end -end -return { - a = 1, - b = 2, - f = Golden_TestUnbinding_I_f, - c = Golden_TestUnbinding_I_f(1)(Golden_TestUnbinding_I_f(2)(1)) -} diff --git a/test/ps/output/Golden.Unbinding.Test/corefn.json b/test/ps/output/Golden.Unbinding.Test/corefn.json new file mode 100644 index 0000000..a77b578 --- /dev/null +++ b/test/ps/output/Golden.Unbinding.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"type":"App"},"identifier":"c"}],"exports":["a","b","f","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Golden","Unbinding","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Unbinding","Test"],"modulePath":"golden/Golden/Unbinding/Test.purs","reExports":{},"sourceSpan":{"end":[6,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestUnbinding/golden.ir b/test/ps/output/Golden.Unbinding.Test/golden.ir similarity index 60% rename from test/ps/output/Golden.TestUnbinding/golden.ir rename to test/ps/output/Golden.Unbinding.Test/golden.ir index f10d6e6..6bf55ef 100644 --- a/test/ps/output/Golden.TestUnbinding/golden.ir +++ b/test/ps/output/Golden.Unbinding.Test/golden.ir @@ -2,7 +2,7 @@ UberModule { uberModuleBindings = [ Standalone ( QName - { qnameModuleName = ModuleName "Golden.TestUnbinding", qnameName = Name "f" + { qnameModuleName = ModuleName "Golden.Unbinding.Test", qnameName = Name "f" }, Abs Nothing ( ParamUnused Nothing ) ( Abs Nothing ( ParamUnused Nothing ) ( LiteralInt Nothing 3 ) ) ) @@ -10,15 +10,15 @@ UberModule [ ( Name "a", LiteralInt Nothing 1 ), ( Name "b", LiteralInt Nothing 2 ), - ( Name "f", Ref Nothing ( Imported ( ModuleName "Golden.TestUnbinding" ) ( Name "f" ) ) 0 ), + ( Name "f", Ref Nothing ( Imported ( ModuleName "Golden.Unbinding.Test" ) ( Name "f" ) ) 0 ), ( Name "c", App Nothing ( App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestUnbinding" ) ( Name "f" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.Unbinding.Test" ) ( Name "f" ) ) 0 ) ( LiteralInt Nothing 1 ) ) ( App Nothing ( App Nothing - ( Ref Nothing ( Imported ( ModuleName "Golden.TestUnbinding" ) ( Name "f" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Golden.Unbinding.Test" ) ( Name "f" ) ) 0 ) ( LiteralInt Nothing 2 ) ) ( LiteralInt Nothing 1 ) diff --git a/test/ps/output/Golden.Unbinding.Test/golden.lua b/test/ps/output/Golden.Unbinding.Test/golden.lua new file mode 100644 index 0000000..ada9243 --- /dev/null +++ b/test/ps/output/Golden.Unbinding.Test/golden.lua @@ -0,0 +1,9 @@ +local Golden_Unbinding_Test_I_f = function(unused1) + return function(unused0) return 3 end +end +return { + a = 1, + b = 2, + f = Golden_Unbinding_Test_I_f, + c = Golden_Unbinding_Test_I_f(1)(Golden_Unbinding_Test_I_f(2)(1)) +} diff --git a/test/ps/output/Golden.TestValues/corefn.json b/test/ps/output/Golden.Values.Test/corefn.json similarity index 50% rename from test/ps/output/Golden.TestValues/corefn.json rename to test/ps/output/Golden.Values.Test/corefn.json index 9134755..e88d16a 100644 --- a/test/ps/output/Golden.TestValues/corefn.json +++ b/test/ps/output/Golden.Values.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,7]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"c"}},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,43],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,16],"start":[16,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["i",{"annotation":{"meta":null,"sourceSpan":{"end":[16,8],"start":[16,7]}},"type":"Var","value":{"identifier":"i","moduleName":["Golden","TestValues"]}}],["b",{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","TestValues"]}}],["c",{"annotation":{"meta":null,"sourceSpan":{"end":[16,14],"start":[16,13]}},"type":"Var","value":{"identifier":"c","moduleName":["Golden","TestValues"]}}]]}},"identifier":"o"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,15],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,16],"start":[13,5]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,8],"start":[13,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,14],"start":[13,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}}]}},"identifier":"a"}],"exports":["i","b","c","a","o","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Golden","TestValues"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestValues"],"modulePath":"golden/Golden/TestValues.purs","reExports":{},"sourceSpan":{"end":[19,11],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,7]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"c"}},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,43],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,16],"start":[16,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["i",{"annotation":{"meta":null,"sourceSpan":{"end":[16,8],"start":[16,7]}},"type":"Var","value":{"identifier":"i","moduleName":["Golden","Values","Test"]}}],["b",{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Values","Test"]}}],["c",{"annotation":{"meta":null,"sourceSpan":{"end":[16,14],"start":[16,13]}},"type":"Var","value":{"identifier":"c","moduleName":["Golden","Values","Test"]}}]]}},"identifier":"o"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,15],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,16],"start":[13,5]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,8],"start":[13,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,14],"start":[13,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}}]}},"identifier":"a"}],"exports":["i","b","c","a","o","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Values","Test"],"modulePath":"golden/Golden/Values/Test.purs","reExports":{},"sourceSpan":{"end":[19,11],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestValues/golden.ir b/test/ps/output/Golden.Values.Test/golden.ir similarity index 100% rename from test/ps/output/Golden.TestValues/golden.ir rename to test/ps/output/Golden.Values.Test/golden.ir diff --git a/test/ps/output/Golden.TestValues/golden.lua b/test/ps/output/Golden.Values.Test/golden.lua similarity index 100% rename from test/ps/output/Golden.TestValues/golden.lua rename to test/ps/output/Golden.Values.Test/golden.lua