Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jun 28, 2023
2 parents 5333abf + 11a98cf commit 0146ce4
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SOFTWARE.
<xsl:if test="$top/descendant-or-self::o[generate-id() = generate-id($current-ancestor)]">
<xsl:for-each select="$current-ancestor/o[@name and generate-id() != generate-id($bottom)]">
<xsl:variable name="copied" select="."/>
<xsl:if test="not($bottom/ancestor-or-self::o[generate-id() = generate-id($copied)])">
<xsl:if test="not($bottom/ancestor-or-self::o[generate-id() = generate-id($copied)]) and $bottom/descendant::o[@base=$copied/@name]">
<xsl:copy-of select="$copied"/>
</xsl:if>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
xsls:
- /org/eolang/parser/optimize/abstracts-float-up.xsl
- /org/eolang/parser/optimize/remove-levels.xsl
tests:
- /program/errors[count(*)=0]
# 'main' object
- //o[@name='main']
- //o[@name='main']/o[@base='sibling' and @name='@']
- //o[@name='main']/o[not(@base) and @name='arg']
- //o[@name='main']/o[@base='main$sibling' and @name='sibling']
- //o[@name='main']/o[@base='main$sibling' and @name='sibling']/o[@base='arg' and not(@name)]
# 'main$sibling' object
- //o[@name='main$sibling' and count(o)=3]
- //o[@name='main$sibling']/o[not(@base) and @name='arg']
- //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first']
- //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first']/o[@base='arg' and not(@name)]
- //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second']
- //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second']/o[@base='arg' and not(@name)]
# 'main$sibling$first' object
- //o[@name='main$sibling$first' and count(o)=3]
- //o[@name='main$sibling$first']/o[@base='arg' and not(@name)]
- //o[@name='main$sibling$first']/o[@base='.one' and @name='@']
- //o[@name='main$sibling$first']/o[not(@base) and @name='arg']
# 'main$sibling$second' object
- //o[@name='main$sibling$second' and count(o)=3]
- //o[@name='main$sibling$second']/o[@base='arg' and not(@name)]
- //o[@name='main$sibling$second']/o[@base='.two' and @name='@']
- //o[@name='main$sibling$second']/o[not(@base) and @name='arg']
# Currently the test converts the code from the snippet to:
# ____
# [arg] > main
# sibling > @
# main$sibling > sibling
# arg
#
# [arg] > main$sibling
# main$sibling$first > first
# arg
# main$sibling$second > second
# arg
#
# [arg] > main$sibling$first
# arg.one > @
#
# [] > main$sibling$second
# arg.two > @
# ____
eo: |
[arg] > main
sibling > @
[] > sibling
[] > first
arg.one > @
[] > second
arg.two > @
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
xsls:
- /org/eolang/parser/optimize/abstracts-float-up.xsl
- /org/eolang/parser/optimize/remove-levels.xsl
tests:
- /program/errors[count(*)=0]
# 'main' object
- //o[@name='main']
- //o[@name='main']/o[@base='sibling' and @name='@']
- //o[@name='main']/o[@base='.eq' and @name='sibling']
- //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$first' and @name='first' and count(o)=1]
- //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$second' and @name='second' and count(o)=1]
# 'main$t2$first' object
- //o[@name='main$t2$first' and count(o)=3]
- //o[@name='main$t2$first']/o[@base='arg' and not(@name)]
- //o[@name='main$t2$first']/o[@base='.one' and @name='@']
- //o[@name='main$t2$first']/o[not(@base) and @name='arg']
# 'main$t2$second' object
- //o[@name='main$t2$second' and count(o)=3]
- //o[@name='main$t2$second']/o[@base='arg' and not(@name)]
- //o[@name='main$t2$second']/o[@base='.two' and @name='@']
- //o[@name='main$t2$second']/o[not(@base) and @name='arg']
# Currently the test converts the code from the snippet to:
# ____
# [arg] > main
# sibling > @
# eq. > sibling
# main$t2$first > first
# arg
# main$t2$second > second
# arg
#
# [arg] > main$t2$first
# arg.one > @
#
# [] > main$t2$second
# arg.two > @
# ____
eo: |
[arg] > main
sibling > @
eq. > sibling
[] > first
arg.one > @
[] > second
arg.two > @
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,14 @@ tests:
# sibling > @
# eq. > sibling
# main$t1$first > first
# @ <-------------------- What is this?
# main$t1$second > second
# @ <-------------------- What is this?
#
# [] > main$t1$first
# 1 > @
#
# [] > main$t1$second
# 2 > @
# ____
# @todo #2126:90min Fix problem with redundant objects.
# Enabling synthetic-attributes-with-to-java.yaml test case still fails.
# The possible reason is the wrong behaviour of abstracts-float-up.xsl
# or remove-levels.xsl transformations. As you can see from the comment above
# - we have strange argument @ that passes into main$t1$first and
# main$t1$second objects which is considered wrong and can cause some problems.
skip: true
eo: |
[] > main
sibling > @
Expand Down

1 comment on commit 0146ce4

@0pdd
Copy link

@0pdd 0pdd commented on 0146ce4 Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2126-624e8604 disappeared from eo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml), that's why I closed #2175. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.