You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling macros like Ecto.Query, you often end up with an error message that can be cryptic, especially with beginners.
For example, the following code without adding require Ecto.Query.
Ecto.Query.fromrowinTable,where: row.name=="fred"
will produce error: undefined variable "row"
This should be an error, but I think that a hint here would go a long way towards helping users understand what needs to happen.
Desired behavior
In this situation, the compiler should check to see if it is within a remote call to a macro that has not been required, and if so provide a helpful message to the user, something along the lines of:
perhaps you are missing require Ecto.Query?
The text was updated successfully, but these errors were encountered:
If pending, you will set "debug" to enabled and expand it again. The enabled debug mode will disable the variables from raising again and change elixir_dispatch to code:ensure_loaded modules when looking for remote functions, in an attempt to find pending macros.
Hey there! I'm taking a look at this issue and I'm currently a bit confused at this part:
change elixir_dispatch to code:ensure_loaded modules when looking for remote functions, in an attempt to find pending macros.
I see that for the Ecto example, there's no mention of Ecto at all on the %Env{} structure for example, how should I get available macros using this helper function?
Another thing that I was thinking about, would it be possible to use the AST from EBody to extract the module + macro name from the call and try to check if it exists, and if so throwing a different error message?
Ecto's case has already been fixed, because the undefined variable warning doesn't stop compilation and we warn about unknown function. So that's no longer a concern. :)
Current behavior
When calling macros like
Ecto.Query
, you often end up with an error message that can be cryptic, especially with beginners.For example, the following code without adding
require Ecto.Query
.will produce
error: undefined variable "row"
This should be an error, but I think that a hint here would go a long way towards helping users understand what needs to happen.
Desired behavior
In this situation, the compiler should check to see if it is within a remote call to a macro that has not been required, and if so provide a helpful message to the user, something along the lines of:
perhaps you are missing require Ecto.Query?
The text was updated successfully, but these errors were encountered: