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

Dyno: named declarations should report their indentation separately from their name locations #25208

Open
DanilaFe opened this issue Jun 10, 2024 · 0 comments

Comments

@DanilaFe
Copy link
Contributor

DanilaFe commented Jun 10, 2024

Today, some of Dyno's AST nodes that subclass NamedDecls (and possibly others) report their location as the name of the node. Thus, in the following code, the location is reported as that of the word myVar:

var myVar = 42;
//  ^^^^^ location

This is inconsistent with other AST nodes in Dyno (the most significant example is probably modules and records, which report their location as the beginning of the keyword). Moreover, we have a mechanism in Dyno by which locations of other part of the AST node can be communicated: additional location maps, introduced by @dlongnecke-cray in #23548.

Currently, the lack of non-name location reporting causes workarounds in language tooling;

# some NamedDecl nodes currently use the name as the location, which
# does not indicate their actual indentation.
if isinstance(child, (VarLikeDecl, TupleDecl, ForwardingDecl)):
continue

is the most significant example, and needed to be expanded in #25207.

It might be necessary to adjust error reporting code to make use of auxiliary location maps to compensate for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant