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

Possible regression when default or union are used as identifiers #132

Closed
ninevra opened this issue Mar 8, 2022 · 0 comments
Closed

Possible regression when default or union are used as identifiers #132

ninevra opened this issue Mar 8, 2022 · 0 comments

Comments

@ninevra
Copy link
Contributor

ninevra commented Mar 8, 2022

I noticed when testing #93 that npm test reports errors in parsing several of the example files:

examples/regex/regex-syntax/src/ast/parse.rs                                                	17 ms	(ERROR [1737, 22] - [1737, 27])
examples/regex/regex-syntax/src/hir/interval.rs                                             	1 ms	(ERROR [288, 28] - [288, 33])
examples/serde/serde_derive/src/de.rs                                                       	9 ms	(ERROR [636, 16] - [636, 25])
examples/serde/serde_derive/src/internals/attr.rs                                           	5 ms	(ERROR [186, 24] - [186, 30])
examples/serde/serde_derive_internals/src/attr.rs                                           	5 ms	(ERROR [186, 24] - [186, 30])

git bisect identifies a360da0 as the first bad commit, and it looks like many of the errors occur when default or union are used as variable names. For example, examples/serde/serde_derive/src/internals/attr.rs contains

        let mut default = Attr::none(cx, "default");

which parses as

(let_declaration [186, 8] - [186, 52]
  (mutable_specifier [186, 12] - [186, 15])
  pattern: (tuple_struct_pattern [186, 16] - [186, 51]
    type: (scoped_identifier [186, 16] - [186, 36]
      path: (identifier [186, 16] - [186, 23])
      (ERROR [186, 24] - [186, 30]
        (identifier [186, 26] - [186, 30]))
      name: (identifier [186, 32] - [186, 36]))
    (identifier [186, 37] - [186, 39])
    (string_literal [186, 41] - [186, 50])))

Before a360da0, that line parsed as

(let_declaration [186, 8] - [186, 52]
  (mutable_specifier [186, 12] - [186, 15])
  pattern: (identifier [186, 16] - [186, 23])
  value: (call_expression [186, 26] - [186, 51]
    function: (scoped_identifier [186, 26] - [186, 36]
      path: (identifier [186, 26] - [186, 30])
      name: (identifier [186, 32] - [186, 36]))
    arguments: (arguments [186, 36] - [186, 51]
      (identifier [186, 37] - [186, 39])
      (string_literal [186, 41] - [186, 50]))))
@amaanq amaanq closed this as completed Aug 18, 2023
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