Getting dialyzer warning "function has no local return" when returning a non-utc DateTime

I’m running into a problem where apparently dyalizer doesn’t recognize a non-utc DateTime as a valid return. I’m simplifying my actual code a lot (if you want to see the full code, it’s here) but if I do, for example:

  def shift_date(base_date) do
    base_date
    |> Timex.shift(days: 5)
    |> Timex.set(hour: 5, minute: 5, second: 0)
  end

Dialyzer is completely fine with it, but if I do:

  def shift_date(base_date) do
    base_date
    |> Timex.shift(days: 5)
    |> Timex.set(hour: 5, minute: 5, second: 0, timezone: "America/Sao_Paulo")
  end

It says that the function has no local return. Does anyone know how to fix this?

That repo is on Timex 3.7.2, the spec for set_options was fixed in 3.7.8:

2 Likes

yeah, that was the problem. thank you!