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

Calling AST node "Length" breaks compilation #437

Open
senier opened this issue Oct 22, 2020 · 1 comment
Open

Calling AST node "Length" breaks compilation #437

senier opened this issue Oct 22, 2020 · 1 comment

Comments

@senier
Copy link
Member

senier commented Oct 22, 2020

How to reproduce

Create an example project:

create-project.py repro

Change ExampleNode to Length:

$ sed -ie 's/ExampleNode/Length/' repro/language/parser.py
$ cd repro && python3 ./manage.py make
[...]
Compile
   [Ada]          parse.adb
parse.adb:137:44: "Length" is not visible
parse.adb:137:44: multiple use clauses cause hiding
parse.adb:137:44: hidden declaration at libreprolang-analysis.ads:88
parse.adb:137:44: hidden declaration at a-strunb.ads:92

   compilation of parse.adb failed

gprbuild: *** compilation phase failed
Build failed: error while running gprbuild -p -j8 -P/home/senier/tmp/langkit/length_issue/repro/build/src/mains.gpr -XBUILD_MODE=dev -XLIBRARY_TYPE=relocatable -XGPR_BUILD=relocatable -XXMLADA_BUILD=relocatable parse.adb:
    Command '['gprbuild', '-p', '-j8', '-P/home/senier/tmp/langkit/length_issue/repro/build/src/mains.gpr', '-XBUILD_MODE=dev', '-XLIBRARY_TYPE=relocatable', '-XGPR_BUILD=relocatable', '-XXMLADA_BUILD=relocatable', 'parse.adb']' returned non-zero exit status 4.

Expected behavior

Either reject Length as AST node name or (preferably) allow it's use in the parser by fully qualifying Ada.Strings.Unbounded.Length (maybe use clauses should be avoided in generated code alltogether).

Versions used

GNAT: Community 2020
Langkit: master (45df941)

@pmderodat
Copy link
Member

Hello @senier!

We are aware of this class of issue (name conflicts in the generated code from otherwise correct language spec). It’s very delicate: unfortunately, avoiding use clauses will both increase the complexity of the code generator and not fix the issue once and for all. We’ll keep this issue open, as we want to get this fixed eventually, but it’s not clear how and when at this stage.

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

No branches or pull requests

2 participants