question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cross reference in separate files with rule name same as type name raises error

See original GitHub issue

The error Use the rule type 'X' instead of the typed rule name 'X' for cross references. is raised when

  1. The name of the referenced type and the name of its parse rule are the same,
  2. The parse rule of the referenced type and the cross reference are placed in different files.

Using different name or placing them in one file can remove this error.

A minimal example:

// file debug.langium
grammar Debug

import './foo'

entry Model:
    (b+=B | a+=A)*;

// A infers A:
//     'A' a=ID;

B infers B:
    'B' b=[A:ID];
// file foo.langium
A infers A:
    'A' a=ID;

terminal ID: /[_a-zA-Z][\w_]*/;

Renaming the rule A or moving it into debug.langium both resolve the error.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
spoenemanncommented, Nov 14, 2022

It would be great if we can add a test for these two issues

See #768

0reactions
msujewcommented, Dec 7, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-reference links do not update to correct heading number
Describes the problem where cross-reference links in Word do not update to the correct heading number after you insert a new heading.
Read more >
46 Working with Cross References
A cross reference name is used to uniquely identify a cross reference table. Two cross reference tables cannot have same name in the...
Read more >
Referencing long names with Python Sphinx - Stack Overflow
I'm working on documentation for my Python module (using Sphinx and reST), and I'm finding that when cross-referencing other Python objects ( ...
Read more >
GNU make
GNU make. This file documents the GNU make utility, which determines automatically which pieces of a large program need to be recompiled, ...
Read more >
Python Scope & the LEGB Rule: Resolving Names in Your Code
Otherwise, you'll get an error. Note: Notice that the local and enclosing Python scopes are searched only if you use a name inside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found