Hi, I encountered an issue with a warning:
warning: comparison between distinct types found:
item == :only
given types:
dynamic(%{..., number: term(), type: binary()}) == :only
where "item" was given the types:
# type: dynamic(%{..., type: term()})
# from: lib/themes/theme_name.ex:5:24
item.type == "previous"
# type: dynamic(%{..., type: binary()})
# from: lib/themes/theme_name.ex:17:24
item.type == "page"
# type: dynamic(%{..., number: term(), type: binary()})
# from: lib/themes/theme_name.ex:19:30
item.number == assigns.current_page
While Elixir can compare across all types, you are comparing across types which are always disjoint, and the result is either always true or always false
type warning found at:
│
23 │ <.link
│ ~~~~~~
│
└─ (themes 1.2.0-11) lib/themes/theme_name.ex:23: Themes.ThemeName."pagination (overridable 1)"/1
The content of the warning is correct, but it is referencing the wrong file. Themes.ThemeName embeds a few components using embed_templates("theme_name/*") (Phoenix.Component.embed_templates/2) and the actual problem in this case is in lib/themes/theme_name/pagination.html.heex.
I’m writing this here, because I’m not sure if this is an issue in Phoenix Liveview or Elixir 1.20. I took a quick look at the issues for both repos, but couldn’t find an issue regarding this.


















