Skip to content

Commit

Permalink
[ re #28 ] Test for hidden import
Browse files Browse the repository at this point in the history
'length' imports 'list' which declares 'map'
'list2' declares 'map'

'import-hidden' imports 'length' and 'list2' but not 'list'.
The resulting global environment has 2 'map' but only one is in
scope so everything works out just fine!
  • Loading branch information
gallais committed Mar 19, 2020
1 parent 3ff620d commit a319cd9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/import-hidden.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
1 change: 1 addition & 0 deletions examples/import-hidden.jsgold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
5 changes: 5 additions & 0 deletions examples/import-hidden.shonkier
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "examples/length.shonkier"
import "examples/list2.shonkier"

id(x) -> x
main() -> length(map(id,[1 2 3]))
1 change: 1 addition & 0 deletions examples/list2.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions examples/list2.jsgold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
4 changes: 4 additions & 0 deletions examples/list2.shonkier
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
map(f,[]) -> []
map(f,[x|xs]) -> [f(x)|map(f,xs)]

main() -> []

0 comments on commit a319cd9

Please sign in to comment.