Open OvermindDL1 opened 5 years ago
Interestingly a PR implementing the second suggestion appears to be at https://github.com/stavro/arc_ecto/pull/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. :-)