So, normally I like to restrict my
alias scopes as little as possible, so instead of adding an alias in the top of a file, I prefer to do it inside a code block.
On older versions of Ash, adding the following code:
alias Marketplace.Markets.Checks, as: MarketsChecks
policy action([:place_offer]) do
Will work fine, but using the latest version, now it gives me the following warning during compilation:
warning: unused alias MarketsChecks
Note that even with the warning, the policy above still works fine.
Is it a easy fix to make this warning go away? I do the same in other code blocks (relationships, calculations, attributes, etc) and they all work fine, I’m only seeing this on the policies block
that is very strange. I was pretty sure we had fixed this issue ages ago. Does it work if you put the alias at the top of the file?
No, got the same warning putting it at the top
Let’s double check your spark version. Do
mix deps.update spark and see if that helps
I’m already in the latest version (1.1.48)
Hmm…oh, could you perhaps try and remove the
as option to the alias and see if the warning goes away?
as option fixed it. But, if possible, I would like to keep it since I added that because it conflicts with another alias that has the same name
Yeah, that makes sense. We made a special thing to avoid these issues, and I suspect it isn’t properly handling
as aliases . Can you open an issue in
spark? In the meantime, you can use the alias you want but add
, warn: false option.
Was that a recent change? Because, weirdly enough, not so old version worked just fine
I will create a ticket in spark ASAP
I don’t think it was a recent change but its possible…