Closed kirillrogovoy closed 6 months ago
Oops, sorry, found the original issue: https://github.com/bamorim/typed_ecto_schema/issues/40
I missed the fact I was using typed_ecto_schema and, yeah, it assumed that a .t() would exist on a third-party module when generating the typespec.
But still wondering if we should provide the "stub" t() type here at least as a workaround.
As you can see, I don't use typespecs 😬 I do not really understand the implications of adding your suggestion.
Yeah, I guess what I was trying to say is that it upsets Dialyzer when using in combination with https://github.com/bamorim/typed_ecto_schema because typed_ecto_schema assumes that there's a typespec for any underlying struct.
It's probably not polymorphic_embed's problem per se, but adding some catch-all spec would hurt nobody, require no maintenance but solve a minor annoyance. :)
Maybe even say that it's a map
not any
Could you update from the current master and keep any
?
Oops, didn't see the rebase.
Done now.
Thanks! 🙌
I'll release it soon. Queueing up a few changes. Ty
Hey,
I don't know if this is the best fix for the issue, but I've noticed that Dialyzer emits the following kind of warning for each PolymorphicEmbed usage:
You can reproduce it by simply creating a new barebones Elixir/Phoenix project, adding Dialyzer, and then trying to use PolymorphicEmbed according to the README.
Again, though this change completely solves the issue for me, I looks and feels like a hack since PolymorphicEmbed doesn't define any structs to begin with. But I got stuck trying to understand where exactly that .t() is being called inside or outside of Dialyzer. 😬