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

fix fields with names containing backticks being inaccessible #1389

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jul 27, 2024

Summary

Fix a regression where field names with backticks in them couldn't be
accessed with a field access.

Fixes #1379.

Details

  • identifier nodes resulting from gensyms are now tagged with a new
    node flag (nfWasGensym)
  • originalName only strips the gensym suffix from identifiers
    marked with the flag
  • the node flag is persistent, so that it stays on the node across tree
    copies

Looking for the full "`gensym" suffix wouldn't work, because it would
also trigger the stripping for user-created names containing the
suffix.

* identifier nodes resulting from gensyms are now tagged with a new
  node flag (`nfWasGensym`)
* `originalName` only strips the `gensym` suffix from identifiers
  marked with the flag
* the node flag is persistent, so that it stays on the node across tree
  copies
@zerbina zerbina added bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler labels Jul 27, 2024
@zerbina zerbina changed the title fix field names containing backticks being inaccessible fix fields with names containing backticks being inaccessible Jul 27, 2024
@saem
Copy link
Collaborator

saem commented Jul 27, 2024

/merge

Copy link

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

@chore-runner chore-runner bot enabled auto-merge July 27, 2024 16:49
@chore-runner chore-runner bot added this pull request to the merge queue Jul 27, 2024
Merged via the queue into nim-works:devel with commit f0c722a Jul 27, 2024
31 checks passed
@zerbina zerbina deleted the fix-field-names-with-backticks branch August 13, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macro generated objects with field name containing '`' cannot be accessed
2 participants