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.
Eh, I forgot what I even had in mind back then. Main point was to allow --warnings-as-errors to propagate to dependencies as well as our own code. No clue how was that even related to non-compilable code (like a module attribute missing but being referenced to).
I’m confused. You had an issue and a solution was posed (use warnings-as-errors flag). You thought it wouldn’t work, but then were informed that it would work as warnings in dependencies don’t halt compilation.
So, problem solved, yes?
Re: why behavior was changed in the past: it was Elixir 1.4, we’re now officially on 1.14. My guess is that the core team’s opinions on maintaining a stable environment have changed in the last 5+ years as adoption had increased. Also, the behavior that was changed was the behavior of an opt-in option, not a default, so the impacted group was more clear-cut and well defined.