eo icon indicating copy to clipboard operation
eo copied to clipboard

Compilation error when accessing attributes without locator in the nested scope

Open tymur-l opened this issue 4 years ago • 15 comments

Steps to reproduce

  1. Place the following code in sandbox/eo/app.eo:
app.eo
+package sandbox
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[] > test
  10 > c
  [] > a
    c > y


[args...] > app
  stdout > @
    sprintf
      "Hello world"
  1. Compile it

Expected output

The program compiles successfully.

Actual output

Compiler log
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< org.eolang:quick-start >-----------------------
[INFO] Building quick-start 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ quick-start ---
[INFO] Deleting /usr/src/mymaven/target
[INFO] 
[INFO] --- eo-maven-plugin:0.1.25:parse (default) @ quick-start ---
[INFO] 48 attributes loaded from 38 stream(s) in 52ms, 48 saved, 373 ignored: ["Agent-Class", "Ant-Version", "Archiver-Version", "Automatic-Module-Name", "Bnd-LastModified", "Build-Jdk", "Build-Jdk-Spec", "Built-By", "Bundl-version", "Bundle-Copyright", "Bundle-Description", "Bundle-DocURL", "Bundle-License", "Bundle-ManifestVersion", "Bundle-Name", "Bundle-RequiredExecutionEnvironment", "Bundle-SymbolicName", "Bundle-Vendor", "Bundle-Version", "Can-Redefine-Classes", "Can-Retransform-Classes", "Can-Set-Native-Method-Prefix", "Created-By", "EO-Version", "Eclipse-ExtensibleAPI", "Eclipse-SourceReferences", "Export-Package", "Extension-Name", "Implementation-Title", "Implementation-URL", "Implementation-Vendor", "Implementation-Vendor-Id", "Implementation-Version", "Import-Package", "Include-Resource", "JCabi-Build", "JCabi-Date", "JCabi-Version", "Main-Class", "Manifest-Version", "Multi-Release", "Premain-Class", "Project-Name", "Require-Capability", "Specification-Title", "Specification-Vendor", "Specification-Version", "Tool"]
[INFO] File /usr/src/mymaven/target/01-parse/app.eo.xml saved (1450 bytes)
[INFO] /usr/src/mymaven/eo/app.eo parsed to /usr/src/mymaven/target/01-parse/app.eo.xml
[INFO] 
[INFO] --- eo-maven-plugin:0.1.25:optimize (default) @ quick-start ---
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/00-not-empty-atoms.xml saved (1499 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/01-middle-varargs.xml saved (1535 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/02-duplicate-names.xml saved (1572 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/03-many-free-attributes.xml saved (1614 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/04-broken-aliases.xml saved (1650 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/05-duplicate-aliases.xml saved (1689 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/06-one-body.xml saved (1719 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/07-same-line-names.xml saved (1756 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/08-self-naming.xml saved (1789 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/09-add-refs.xml saved (1827 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/10-wrap-method-calls.xml saved (1866 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/11-vars-float-up.xml saved (1901 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/12-add-refs.xml saved (1931 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/13-resolve-aliases.xml saved (1968 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/14-resolve-aliases.xml saved (2034 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/15-add-default-package.xml saved (2097 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/16-broken-refs.xml saved (2130 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/17-unknown-names.xml saved (2165 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/18-noname-attributes.xml saved (2204 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/19-duplicate-names.xml saved (2241 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/20-data-objects.xml saved (2275 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/21-globals-to-abstracts.xml saved (2317 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/22-remove-refs.xml saved (2342 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/23-abstracts-float-up.xml saved (2663 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/24-remove-levels.xml saved (2698 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/25-add-refs.xml saved (2746 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/26-fix-missed-names.xml saved (2784 bytes)
[INFO] File /usr/src/mymaven/target/02-steps/app.eo.xml/27-broken-refs.xml saved (2817 bytes)
[INFO] File /usr/src/mymaven/target/03-optimize/app.eo.xml saved (2817 bytes)
[INFO] /usr/src/mymaven/target/01-parse/app.eo.xml optimized to /usr/src/mymaven/target/03-optimize/app.eo.xml, all steps are in /usr/src/mymaven/target/02-steps/app.eo.xml
[INFO] 
[INFO] --- eo-maven-plugin:0.1.25:compile (default) @ quick-start ---
[INFO] Gen directory created: /usr/src/mymaven/target/generated-sources
[INFO] /usr/src/mymaven/target/05-compile directory created
[INFO] /usr/src/mymaven/target/04-pre directory created
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/00-pre-classes.xml saved (2890 bytes)
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/01-pre-junit.xml saved (2921 bytes)
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/02-pre-attrs.xml saved (3434 bytes)
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/03-pre-varargs.xml saved (3471 bytes)
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/04-pre-arrays.xml saved (3503 bytes)
[INFO] File /usr/src/mymaven/target/04-pre/app.eo.xml/05-pre-data.xml saved (3659 bytes)
You must explicitly say "^.c" instead of just "c" on line 8
[ERROR] #fatalError(): Processing terminated by xsl:message at line 282 in file:///; SystemID: file:///; Line#: 282
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.902 s
[INFO] Finished at: 2021-06-29T13:39:38Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eolang:eo-maven-plugin:0.1.25:compile (default) on project quick-start: Execution default of goal org.eolang:eo-maven-plugin:0.1.25:compile failed: failed to transform by net.sf.saxon.TransformerFactoryImpl: Processing terminated by xsl:message at line 282 in file:/// -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
ERROR: 1

Analysis

Looks like access to c in the nested object test.a breaks the compiler, because when it is removed or when locator ^ is specified - the program compiles successfully.

The case looks even stranger, when trying to run the following program (example from paper):

Program
+package sandbox
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[child height] > shape
  [] > volume
    child.square.mul ^.height

[height r] > circle
  memory r > radius
  shape $ height > @
  [] > square
    3.14.mul
      radius.mul
        radius


[args...] > app
  stdout > @
    sprintf
      "Hello world"

Because the program compiles successfully, even though it contains references to the upper level objects without an explicit locator in an inner object (circle.square references circle.radius relatively).

I can't understand why the behavior is as described, so I am submitting this issue in order to figure out what's happening.

tymur-l avatar Jun 29 '21 13:06 tymur-l

@Sitiritis definitely something is wrong here, thanks for reporting

yegor256 avatar Sep 15 '21 08:09 yegor256

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Sep 25 '21 13:09 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Sep 30 '21 13:09 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Oct 05 '21 16:10 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Nov 06 '21 16:11 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Nov 20 '21 16:11 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Nov 25 '21 17:11 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Jan 16 '22 18:01 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Feb 20 '22 10:02 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Mar 17 '22 13:03 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar Apr 02 '22 03:04 0crat

@yegor256/z everybody who has role DEV is banned at #307; I won't be able to assign anyone automatically; consider assigning someone manually (as in §19), or invite more people (as in §51), or remove the job from the scope (as in §14)

0crat avatar May 01 '22 23:05 0crat

@mximp please help

yegor256 avatar Jul 15 '22 06:07 yegor256

I've repeated the steps in the description and the code has successfully compiled. Current version of eo-maven-plugin (which I used):

[INFO] --- eo-maven-plugin:0.23.19:transpile (default) @ sandbox ---

The version in the description is:

[INFO] --- eo-maven-plugin:0.1.25:compile (default) @ quick-start ---

which is quite behind the current one.

Also both snippets in the description contains double line carriage which is not compilable with current version of the plugin.

@Sitiritis @yegor256 If the issue cannot be reproduced with new version of the plugin and corrected code - I suggest to close it.

mximp avatar Jul 20 '22 09:07 mximp

@Sitiritis @yegor256 please check comment above

mximp avatar Jul 27 '22 15:07 mximp

@yegor256 @Sitiritis if there are still issues?

mximp avatar Aug 19 '22 10:08 mximp

@yegor256 @Sitiritis reminder

mximp avatar Aug 25 '22 13:08 mximp

@Sitiritis I'm closing. if any more similar issues, please open a new ticket

yegor256 avatar Aug 25 '22 13:08 yegor256