Skip to content

Commit

Permalink
fix a few issues with lambda capture tests - apparently current const…
Browse files Browse the repository at this point in the history
… by default for ptrs is not right (should implement multiple/deep mut annotation anyway)
  • Loading branch information
ehren committed Aug 15, 2024
1 parent e3cdc3a commit 1585f7f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,12 +1786,13 @@ def f2():
compile(r"""
def (main:
y = 5
x : int:ptr = &y
x : const:int:ptr:const = &y # TODO just int:ptr used to work but now doesn't (though multiple mut syntax for pointers arguably should be implemented)
lambda (:
l = lambda (:
std.cout << x
return
) ()
)
l() # NOTE: in the event we scan for non-escaping lambdas this may need updating (ref capture would be fine in such a case)
)
""")
raises(f2)
Expand All @@ -1800,10 +1801,11 @@ def f3():
def (main:
s = "nope"
lambda (:
l = lambda (:
std.cout << s
return
) ()
)
l()
)
""")
raises(f3)
Expand Down

0 comments on commit 1585f7f

Please sign in to comment.