warning: undefined module attribute @seconds, please remove access to @seconds or explicitly set it before access
lib/api_baas/accounts_admins/admin_user_token.ex:120: ApiBaas.AccountsAdmins.AdminUserToken (module)
Yes, tests should caught it, but why doesn’t the compiler abort compilation when it finds this?
Yes, I know that warnings can be enabled to behave as errors, but some warnings need to behave as warnings, and not halt the compiler.
I am curious about the reason for this to be considered as an warning and not an error?
I only have 1.13 + OTP 25 right at hand to test, but on that version I still get the same warning from plug when running mix compile --warnings-as-errors with an empty _build directory.
However, --warnings-as-errors doesn’t turn warnings in dependencies into errors.
Some historical digging reveals that it used to; around the time of Elixir 1.4 that was changed, by commits like:
Well IMO this is a reasonable request. An opt-in configuration to allow compilation failure if any warning is in the project’s or any of the dependencies’ code should do the trick. There are orgs that inspect and slightly modify their project deps.
I really don’t understand the rational of allowing this breaking change and not allowing the breaking change that would really fix the issue and make Elixir compilation to deliver a more robust code, instead of buggy code as it does at the moment.
The rationale of postponing for v2.0 really puzzles me, because that version may never exist as Jose keeps saying, but even if it was scheduled it doesn’t make any sense in my mind to wait, because this is a compiler bug that should be fixed, because a compiler that produces bad code output isn’t helping anyone.