-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with using tuple.at
inside of bool.while
#2834
Comments
@maxonfjvipon WDYT? Do you have any ideas? |
@c71n93 I think you need to try to repeat such behavior in test written on Java. Then it'll be possible to debug it |
@maxonfjvipon I implemented this broken test on Java (#2839), but behaviour was different (test on Java didn't fail). Then I discovered that the problem is This two tests work differently:
In the second test I couldn't figure out what the reason might be. Obviously, code generated from @maxonfjvipon Do you have any ideas? |
@c71n93 I wrote the same tests in java and first test returned 1, the second returned 0: @Test
void test() {
Phi counter = new EOmemory(Phi.Φ);
counter.attr(0).put(new Data.ToPhi(0L));
Phi arr = new PhWith(
new PhWith(
new EOtuple$EOempty(Phi.Φ).attr("with").get().copy(),
0, new Data.ToPhi(0L)
).attr("with").get().copy(),
0, new Data.ToPhi(1L)
);
Phi first = new PhWith(new PhCopy(new PhMethod(counter, "write")), 0, new Data.ToPhi(0L));
Phi second = new PhWith(
new PhCopy(new PhMethod(arr, "at")),
0, new PhMethod(counter, "as-int")
);
Phi args = new PhWith(
new PhCopy(
new PhMethod(
new PhWith(
new PhCopy(
new PhMethod(
new PhWith(
new PhCopy(new PhMethod(new EOtuple$EOempty(Phi.Φ), "with")),
0,
first
),
"with"
)
),
0,
new PhWith(
new PhCopy(new PhMethod(counter, "write")),
0,
new PhWith(
new PhCopy(new PhMethod(new PhMethod(counter, "as-int"), "plus")),
0, new Data.ToPhi(1L)
)
)
),
"with"
)
),
0, new PhMethod(counter, "as-int")
);
System.out.println(
new Dataized(
new PhWith(new EOseq(Phi.Φ), 0, args)
).take(Long.class)
);
}
|
@c71n93 And yes, there's something wrong, but it's not related to It caches the attribute that was got though decorator (φ or λ). If we're removing the caching - both tests become returning 1. And I think the MAIN problem here is mutability of |
Co-authored-by: maxonfjvipon <[email protected]>
@c71n93 still an issue? |
@maxonfjvipon it was resolved |
The puzzles #2818 and #2819 describe the problems with
bool.while
. Trying to figure out what's wrong with the test from puzzle #2818, I got a strange result. I tried to simplify the test and took an already existing working test.This test from
bool-test.eo
is passing successfully:This modified test fails with error:
The only thing I added here is iterating over a tuple before incrementing
x
(arr.at (x.as-int)
). It turns out that in this case there is one extra iteration. I have not been able to figure out what exactly the problem is here.The text was updated successfully, but these errors were encountered: