Skip to content
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

Example which doesn't work in v4.x #464

Closed
kushti opened this issue Apr 4, 2019 · 4 comments · Fixed by #758
Closed

Example which doesn't work in v4.x #464

kushti opened this issue Apr 4, 2019 · 4 comments · Fixed by #758
Assignees
Labels
4h Approximately 4 hours of work A-tests Area: Test coverage C-enhancement Category: A PR with an enhancement or a proposed one in an issue. P2-medium Priority: Medium
Milestone

Comments

@kushti
Copy link
Member

kushti commented Apr 4, 2019

UPD[@aslesarenko]:
Make sure the following example works with JITC.

For example,

path.fold(item, {(a: (Coll[Byte], Coll[Byte])) =>
a._1.zip(a._2).map({ (c: (Byte, Byte)) => (c._1 ^ c._2).toByte })
})

does not compile, and I'm not sure whether it is okay or not. Please describe fold limitations in the spec.

@kushti kushti added the C-question Category: Question label Apr 4, 2019
@aslesarenko
Copy link
Member

@kushti is this example is committed to some branch to reproduce?

@aslesarenko aslesarenko added the A-tests Area: Test coverage label May 7, 2019
@aslesarenko aslesarenko added C-bug Category: This is a bug P2-medium Priority: Medium S-can't-reproduce Status: Cannot reproduce the bug or problem and removed A-tests Area: Test coverage labels Dec 23, 2019
@aslesarenko aslesarenko added this to the v3.x milestone Dec 23, 2019
@aslesarenko
Copy link
Member

Nested loops are not supported in in AOT costing.
Here map is nested in Fold and hence leads to error.
This example should work fine with JIT costing, moving to 4.0 milestone.

@aslesarenko aslesarenko modified the milestones: v3.x, v4.0 Jun 8, 2020
@aslesarenko aslesarenko added A-tests Area: Test coverage help wanted C-enhancement Category: A PR with an enhancement or a proposed one in an issue. and removed C-question Category: Question S-can't-reproduce Status: Cannot reproduce the bug or problem C-bug Category: This is a bug labels Jun 8, 2020
@aslesarenko aslesarenko added 4h Approximately 4 hours of work and removed help wanted labels Sep 16, 2020
@aslesarenko aslesarenko changed the title What are the limits of the fold function? Example which doesn't work in v4.x Dec 17, 2021
@aslesarenko aslesarenko mentioned this issue Dec 17, 2021
21 tasks
@aslesarenko
Copy link
Member

bitwise xor operation ^ is not implemented in v4.x and in v5.0.
So, exactly that example will not work in v5.0, but the following will work

val foo = path.fold(item, { (a: Coll[Byte], b: Coll[Byte]) =>
    a.zip(b).map({ (c: (Byte, Byte)) => (c._1 + c._2).toByte })
  })

See property("nested loops: map inside fold")

@aslesarenko
Copy link
Member

Implementing ^ is part of #474 and will be done there. The test for this example is added, this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4h Approximately 4 hours of work A-tests Area: Test coverage C-enhancement Category: A PR with an enhancement or a proposed one in an issue. P2-medium Priority: Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants