-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more naturalL4 and honour name shadowing
After adding a test case, I realised the name shadowing did not work as anticipated. We fix this now, move some code around and extend the transpiler to work correctly for many more naturalL4 constructs and fragments.
- Loading branch information
Showing
10 changed files
with
723 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
356 changes: 184 additions & 172 deletions
356
lib/haskell/natural4/src/LS/XPile/Simala/Transpile.hs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
308 changes: 308 additions & 0 deletions
308
...ural4/test/testdata/golden/renamer/function-with-name-shadowing-with-where-rules.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,308 @@ | ||
Right | ||
[ Hornlike | ||
( RnHornlike | ||
{ name = | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "f" :| [] | ||
, rnUniqueId = 1 | ||
, rnNameType = RnFunction | ||
} | ||
) | ||
, RnExprName | ||
( RnName | ||
{ rnOccName = MTT "x" :| [] | ||
, rnUniqueId = 0 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, super = Nothing | ||
, keyword = Decide | ||
, given = Just | ||
( RnParamText | ||
{ mkParamText = RnTypedMulti | ||
{ rnTypedMultiExpr = RnExprName | ||
( RnName | ||
{ rnOccName = MTT "x" :| [] | ||
, rnUniqueId = 0 | ||
, rnNameType = RnVariable | ||
} | ||
) :| [] | ||
, rnTypedMultiTypeSig = Nothing | ||
} :| [] | ||
} | ||
) | ||
, giveth = Nothing | ||
, upon = Nothing | ||
, clauses = | ||
[ RnHornClause | ||
{ rnHcHead = RnConstraint | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "f" :| [] | ||
, rnUniqueId = 1 | ||
, rnNameType = RnFunction | ||
} | ||
) | ||
, RnExprName | ||
( RnName | ||
{ rnOccName = MTT "x" :| [] | ||
, rnUniqueId = 0 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] RPis | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, rnHcBody = Nothing | ||
} | ||
] | ||
, rlabel = Nothing | ||
, lsource = Nothing | ||
, wwhere = | ||
[ Hornlike | ||
( RnHornlike | ||
{ name = | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, super = Nothing | ||
, keyword = Where | ||
, given = Nothing | ||
, giveth = Just | ||
( RnParamText | ||
{ mkParamText = RnTypedMulti | ||
{ rnTypedMultiExpr = RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) :| [] | ||
, rnTypedMultiTypeSig = Nothing | ||
} :| [] | ||
} | ||
) | ||
, upon = Nothing | ||
, clauses = | ||
[ RnHornClause | ||
{ rnHcHead = RnConstraint | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] RPis | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "g" :| [] | ||
, rnUniqueId = 4 | ||
, rnNameType = RnFunction | ||
} | ||
) | ||
, RnExprName | ||
( RnName | ||
{ rnOccName = MTT "x" :| [] | ||
, rnUniqueId = 0 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, rnHcBody = Nothing | ||
} | ||
] | ||
, rlabel = Nothing | ||
, lsource = Nothing | ||
, wwhere = [] | ||
, srcref = Just | ||
( SrcRef | ||
{ url = "test/Spec" | ||
, short = "test/Spec" | ||
, srcrow = 1 | ||
, srccol = 1 | ||
, version = Nothing | ||
} | ||
) | ||
, defaults = [] | ||
, symtab = [] | ||
} | ||
) | ||
, Hornlike | ||
( RnHornlike | ||
{ name = | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "g" :| [] | ||
, rnUniqueId = 4 | ||
, rnNameType = RnFunction | ||
} | ||
) | ||
, RnExprName | ||
( RnName | ||
{ rnOccName = MTT "d" :| [] | ||
, rnUniqueId = 3 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, super = Nothing | ||
, keyword = Where | ||
, given = Just | ||
( RnParamText | ||
{ mkParamText = RnTypedMulti | ||
{ rnTypedMultiExpr = RnExprName | ||
( RnName | ||
{ rnOccName = MTT "d" :| [] | ||
, rnUniqueId = 3 | ||
, rnNameType = RnVariable | ||
} | ||
) :| [] | ||
, rnTypedMultiTypeSig = Nothing | ||
} :| [] | ||
} | ||
) | ||
, giveth = Nothing | ||
, upon = Nothing | ||
, clauses = | ||
[ RnHornClause | ||
{ rnHcHead = RnConstraint | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "g" :| [] | ||
, rnUniqueId = 4 | ||
, rnNameType = RnFunction | ||
} | ||
) | ||
, RnExprName | ||
( RnName | ||
{ rnOccName = MTT "d" :| [] | ||
, rnUniqueId = 3 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] RPis | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, rnHcBody = Nothing | ||
} | ||
] | ||
, rlabel = Nothing | ||
, lsource = Nothing | ||
, wwhere = | ||
[ Hornlike | ||
( RnHornlike | ||
{ name = | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, super = Nothing | ||
, keyword = Where | ||
, given = Nothing | ||
, giveth = Nothing | ||
, upon = Nothing | ||
, clauses = | ||
[ RnHornClause | ||
{ rnHcHead = RnNary RPis | ||
[ RnRelationalTerm | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "y" :| [] | ||
, rnUniqueId = 2 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, RnNary RPsum | ||
[ RnRelationalTerm | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "d" :| [] | ||
, rnUniqueId = 3 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
, RnRelationalTerm | ||
[ RnExprName | ||
( RnName | ||
{ rnOccName = MTT "d" :| [] | ||
, rnUniqueId = 3 | ||
, rnNameType = RnVariable | ||
} | ||
) | ||
] | ||
] | ||
] | ||
, rnHcBody = Nothing | ||
} | ||
] | ||
, rlabel = Nothing | ||
, lsource = Nothing | ||
, wwhere = [] | ||
, srcref = Just | ||
( SrcRef | ||
{ url = "test/Spec" | ||
, short = "test/Spec" | ||
, srcrow = 1 | ||
, srccol = 1 | ||
, version = Nothing | ||
} | ||
) | ||
, defaults = [] | ||
, symtab = [] | ||
} | ||
) | ||
] | ||
, srcref = Just | ||
( SrcRef | ||
{ url = "test/Spec" | ||
, short = "test/Spec" | ||
, srcrow = 1 | ||
, srccol = 1 | ||
, version = Nothing | ||
} | ||
) | ||
, defaults = [] | ||
, symtab = [] | ||
} | ||
) | ||
] | ||
, srcref = Just | ||
( SrcRef | ||
{ url = "test/Spec" | ||
, short = "test/Spec" | ||
, srcrow = 1 | ||
, srccol = 1 | ||
, version = Nothing | ||
} | ||
) | ||
, defaults = [] | ||
, symtab = [] | ||
} | ||
) | ||
] |
Oops, something went wrong.