[go: up one dir, main page]

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

Warning: expression updates a literal on upcoming OTP 27 #353

Closed
maennchen opened this issue Feb 20, 2024 · 2 comments · Fixed by #354
Closed

Warning: expression updates a literal on upcoming OTP 27 #353

maennchen opened this issue Feb 20, 2024 · 2 comments · Fixed by #354
Labels
help wanted Extra attention is needed
Milestone

Comments

@maennchen
Copy link
Contributor
maennchen commented Feb 20, 2024

https://github.com/erlef/oidcc/actions/runs/7978117370/job/21787920914?pr=337

===> Compiling erlfmt
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:98:71: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:153:39: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:155:39: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:379:37: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:382:37: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:526:37: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:529:37: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:539:37: Warning: expression updates a literal
  _build/default/plugins/erlfmt/src/erlfmt_parse.yrl:542:37: Warning: expression updates a literal

node -> standalone_exprs exprs dot : {exprs, (?range_anno('$1', '$3'))#{dot => true}, '$2'}.

It seems like the following is no longer allowed:

expr()#{property => value}

The code therefore will have to use maps:put/3 or maps:merge/2 instead.

I'd be happy to provide a PR for that change.

@michalmuskala
Copy link
Member

Yes, a PR would definitely be welcome. Either maps:put should work, alternative could be to try and redefine the macro as:

-define(range_anno(Tok1, Tok2), begin #{
    location => map_get(location, ?anno(Tok1)),
    end_location => map_get(end_location, ?anno(Tok2))
} end).

I wonder if this might be enough to "fool" the compiler into not emitting a warning

@michalmuskala michalmuskala added the help wanted Extra attention is needed label Feb 21, 2024
@michalmuskala michalmuskala added this to the OTP 27 milestone Feb 21, 2024
@maennchen
Copy link
Contributor Author

@michalmuskala Yes, the begin ... end trick works. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants