Will Phoenix 1.16 require unique route helpers?

Trying phoenix 1.16-rc.0, I get a bunch of warnings in our router. I believe this is because many different routes have the same helper name. In phoenix 1.15 this was not issuing warnings. Is this a bug or a feature?

I’ll note that the warnings are not as clear as they could be:

warning: this clause for admin_account_path/3 cannot match because a previous clause at line 0 always matches
  lib/bobby_web/router.ex

warning: this clause for admin_account_url/3 cannot match because a previous clause at line 0 always matches
  lib/bobby_web/router.ex

warning: this clause for admin_beneficiary_path/3 cannot match because a previous clause at line 0 always matches
  lib/bobby_web/router.ex

warning: this clause for admin_beneficiary_url/3 cannot match because a previous clause at line 0 always matches
  lib/bobby_web/router.ex
[...]

No! We have always allowed those and we have a heuristic to handle conflicts by compiling all clauses in a certain order. However, as the Elixir compiler gets smarter, we can now see those conflicts and warn. The fix is to change Phoenix to not emit those duplications, something I just pushed to master and v1.5 branches.

I just need to understand why the line information is 0. It should be at least the module line.

9 Likes

Good, thanks. Let me know if I should file an issue or provide any additional info.

It has been addressed. :slight_smile:

3 Likes