Skip to content

Commit

Permalink
tests: Added new test from #3315
Browse files Browse the repository at this point in the history
Also duplicated the tests in `reg_issue3308` to be executed within a function
`b` additionally to the constructor `a`.  This includes the case from #3324,
which is currently commented out in the test.
  • Loading branch information
fridis committed Jul 7, 2024
1 parent 554fe9e commit ff97d4c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/reg_issue3308/reg_issue3308.fz
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
reg_issue3308 is

f(x ()->unit) =>
g(x ()->unit) => _ := x.call

t is
a is
Expand All @@ -47,4 +48,35 @@ reg_issue3308 is
t(_ unit) =>
_ := f (t unit)

# fifth: access outer ref in partial application and call `as_string`
redef as_string => "--a--"
u(x Any) => say x
say (g (u a.this))

# same thing using a function `b` instead of a constructor `a`:
b =>

# first, b.this is part of the target of the partial call
q =>
say (f b.this.q)

# second, b.this is part of the arguments of the partial call
r(x _) =>
say (f (r b.this))

# third, b.this is part of the arguments of the partial call and
# boxed to Any, see #3315
s(x Any) =>
say (f (s b.this))

# fouth, an even simpler version of #3315
t(_ unit) =>
_ := f (t unit)

# fifth: access outer ref in partial application and call `as_string`
redef as_string => "--b--"
u(x Any) => say x
# say (g (u b.this)) -- NYI: BUG #3324: does not work yet!

_ := t.a
_ := t.b
5 changes: 5 additions & 0 deletions tests/reg_issue3308/reg_issue3308.fz.expected_out
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unit
unit
unit
--a--
unit
unit
unit
unit

0 comments on commit ff97d4c

Please sign in to comment.