Skip to content

Calling AST node "Length" breaks compilation #437

@senier

Description

@senier

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions