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
Because this is a defmacro the whole body is getting inlined, which is what's causing this error. There is not really a need for it to be a defmacro and it could/should probably just be a normal def, in which case the inferred spec then should work. Alternatively you can change the case changeset_or_data do to be wrapped be something like case Arc.Ecto.Schema.wrap(changeset_or_data) do to opaque it, but then you could just do the work there as well. Likely all around easier and better for cast_attachments to just not be a macro at all however. :-)
The text was updated successfully, but these errors were encountered:
Interestingly a PR implementing the second suggestion appears to be at #106 but has not been accepted or rejected yet a month later. Although that does fix it and keeps the API, it's probably better to just bump the API version and change the defmacro to just dev, since a cross module call is being performed anyway it doesn't save anything otherwise and can actually slow down the function calling cast_attachments due to ballooning its opcode size (not that it really matters on this path). :-)
For the given code:
The
cast_attachments(params, [:file_id])
expression is causing a dialyzer failure of (some formatting so it's actually readable):In arc_ecto's
schema.ex
file lines 15 to 18 are:Because this is a
defmacro
the whole body is getting inlined, which is what's causing this error. There is not really a need for it to be adefmacro
and it could/should probably just be a normaldef
, in which case the inferred spec then should work. Alternatively you can change thecase changeset_or_data do
to be wrapped be something likecase Arc.Ecto.Schema.wrap(changeset_or_data) do
to opaque it, but then you could just do the work there as well. Likely all around easier and better forcast_attachments
to just not be a macro at all however. :-)The text was updated successfully, but these errors were encountered: