-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Make options in the -compile
attribute take precedence
#8093
Make options in the -compile
attribute take precedence
#8093
Conversation
CT Test Results 2 files 324 suites 8m 59s ⏱️ Results for commit 06d0e7c. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
Are we sure all the passes in the compiler use the "last option wins" approach, so that the documentation, which option takes precedence is correct? It's definitely true of |
No, other passes generally take the first option. However, the other options generally don't come in pairs (one to enable and one to disable a feature), so the order should not matter. I will take another look to see whether there any other option where the order would matter. |
Change the compiler option processing order so that options given in the `compile()` attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment. This order makes most sense, as each module might need customized options. Fixes erlang#6979
cd7d88d
to
06d0e7c
Compare
If that's the case, I wonder if it would make sense to instead change the implementation in |
06d0e7c
to
7a8fa4d
Compare
Unfortunately, this change doesn't work for the particular combination
(So, it doesn't fix #6979) The PR changes the phase otp/lib/compiler/src/compile.erl Lines 1584 to 1630 in f11b248
Additionally, erl_lint itself reads options from the otp/lib/stdlib/src/erl_lint.erl Lines 689 to 698 in f11b248
And lastly, - whether the check is enabled is configured through otp/lib/stdlib/src/erl_lint.erl Lines 750 to 752 in f11b248
And since otp/lib/stdlib/src/erl_lint.erl Lines 102 to 106 in f11b248
|
@ilya-klyuchnikov Thanks! I have reverted this PR for now. The plan is to implement it correctly (with test cases) in a new PR and to include it in RC2. |
Change the compiler option processing order so that options given in the `compile()` attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute take precedence over options given to the compiler, which in turn take precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute take precedence over options given to the compiler, which in turn take precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute take precedence over options given to the compiler, which in turn take precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the `compile()` attribute take precedence over options given to the compiler, which in turn take precedence over options given in the environment. This order makes most sense, as each module might need customized options. While at it, remove the undocumented `strict_record_updates` / `no_strict_record_updates` options. Their naming no longer make any sense, because record updates are always strict (that is, the source record must have the correct tag and size). Incorporate the behavior of `strict_record_updates` to update the record by matching and building a new tuple into the `dialyzer` option. When dialyzer is not used, records are updated using `setelement/3`, which is more efficient in the JIT. (This is the second attempt to fix erlang#6979, as erlang#8093 did not really work.)
Change the compiler option processing order so that options given in the
compile()
attribute takes precedence over options given to the compiler, which in turn takes precedence over options given in the environment.This order makes most sense, as each module might need customized options.
Fixes #6979