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

517 fix stream rules incorrectly modify the code produced by the opeo-maven-plugin #519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deemp
Copy link
Member

@deemp deemp commented Oct 25, 2024


PR-Codex overview

This PR focuses on updating the naming conventions in the streams.yaml file to use the correct package names for Java streams, changing java_util_Stream to java_util_stream_Stream throughout the file.

Detailed summary

  • Updated forall section, replacing !b2 with !b3.
  • Changed pattern from !b1.java_util_Stream$map to !b1.java_util_stream_Stream$map.
  • Updated fresh prefix from java_util_Stream$map_result to java_util_stream_Stream$map_result.
  • Modified test cases to reflect the new package names, including java_util_Stream$filter and java_util_Stream$toList.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@deemp deemp linked an issue Oct 25, 2024 that may be closed by this pull request
1 task
@deemp
Copy link
Member Author

deemp commented Oct 25, 2024

@fizruk
Copy link
Collaborator

fizruk commented Oct 25, 2024

@deemp I believe the example should be changed, not the rule. Since we have changed the rule to match the actual output of eo phi for Java Streams.

@deemp
Copy link
Member Author

deemp commented Oct 25, 2024

@fizruk, why don't we use !b3?

!b1.java_util_stream_Stream$map(α0 ↦ !b3, α1 ↦ !b2) * !t1

!τ2 ↦ !b1,
!τ3 ↦ Φ.opeo.map-for-each(
α0 ↦ ξ.!τ2,
α1 ↦ !b2
),
φ ↦ ξ.!τ3 * !t1
⟧.φ

@fizruk
Copy link
Collaborator

fizruk commented Oct 25, 2024

@deemp !b3 is a descriptor, inserted by the translation from Java to EO, for extra information. Since we remove the map and replace it with a map-foreach-each, we lose the descriptor.

@fizruk
Copy link
Collaborator

fizruk commented Oct 25, 2024

I think you should add a more realistic example from #470 to the tests here.

@deemp deemp changed the title 517 fix stream rules don't modify the code produced by the opeo-maven-plugin 517 fix stream rules incorrectly modify the code produced by the opeo-maven-plugin Oct 25, 2024
@deemp
Copy link
Member Author

deemp commented Oct 25, 2024

@fizruk, I ran eo-phi-normalizer test --rules eo-phi-normalizer/test/eo/phi/rules/streams.yaml and got 3 outputs. It doesn't look like an expected result.

        input: |

            α0 ↦ Φ.org.eolang.checkcast(
              α1 ↦ ξ.java.util.stream.j$Stream.java_util_stream_Stream$of(
                α0 ↦ Φ.org.eolang.string,
                α1 ↦ ξ.ref-avilqrqcdj.write-array
              ).java_util_stream_Stream$map(
                α0 ↦ Φ.org.eolang.string,
                α1 ↦ Φ.org.eolang.labeled
              ).java_lang_Object$collect(
                α0 ↦ Φ.org.eolang.string,
                α1 ↦ ξ.java.util.stream.j$Collectors.java_util_stream_Collector$joining
              )
            ),

        output:
        - |

            α0 ↦ Φ.org.eolang.checkcast (α1 ↦ ⟦
              foreach_body$1 ↦ ξ.java.util.stream.j$Stream.java_util_stream_Stream$of (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.ref-avilqrqcdj.write-array),
              java_util_stream_Stream$map_result$1 ↦ Φ.opeo.map-for-each (α0 ↦ ξ.foreach_body$1, α1 ↦ Φ.org.eolang.labeled),
              φ ↦ ξ.java_util_stream_Stream$map_result$1.java_lang_Object$collect (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.java.util.stream.j$Collectors.java_util_stream_Collector$joining)
            ⟧.φ)

        - |

            α0 ↦ Φ.org.eolang.checkcast (α1 ↦ ⟦
              foreach_body$1 ↦ ξ.java.util.stream.j$Stream.java_util_stream_Stream$of (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.ref-avilqrqcdj.write-array),
              java_util_stream_Stream$map_result$1 ↦ Φ.opeo.map-for-each (α0 ↦ ξ.foreach_body$1, α1 ↦ Φ.org.eolang.labeled),
              φ ↦ ξ.java_util_stream_Stream$map_result$1.java_lang_Object$collect
            ⟧.φ (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.java.util.stream.j$Collectors.java_util_stream_Collector$joining))

        - |

            α0 ↦ Φ.org.eolang.checkcast (α1 ↦ ⟦
              foreach_body$1 ↦ ξ.java.util.stream.j$Stream.java_util_stream_Stream$of (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.ref-avilqrqcdj.write-array),
              java_util_stream_Stream$map_result$1 ↦ Φ.opeo.map-for-each (α0 ↦ ξ.foreach_body$1, α1 ↦ Φ.org.eolang.labeled),
              φ ↦ ξ.java_util_stream_Stream$map_result$1

          .φ.java_lang_Object$collect (α0 ↦ Φ.org.eolang.string, α1 ↦ ξ.java.util.stream.j$Collectors.java_util_stream_Collector$joining))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix stream rules incorrectly modify the code produced by the opeo-maven-plugin
2 participants