marcandre

marcandre

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
[...]

Marked As Solved

josevalim

josevalim

Creator of Elixir

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.

Also Liked

josevalim

josevalim

Creator of Elixir

It has been addressed. :slight_smile:

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New

We're in Beta

About us Mission Statement