elixir-cldr / cldr

Elixir implementation of CLDR/ICU
Other
447 stars 33 forks source link

Dialyzer show some warnings #162

Closed alaadahmed closed 2 years ago

alaadahmed commented 2 years ago

elixir version: 1.13.0-rc.1 ex_cldr version: 2.24.1

Dialyzer shows some warning on the Cldr Backend file. Warning is:

The function call will not succeed.

AhramSchoolWeb.Cldr.Number.Transliterate.transliterate(_ :: binary(), :latn, _ :: atom())

breaks the contract
(String.t(), Cldr.LanguageTag.t() | Cldr.Locale.locale_name(), String.t() | atom()) ::
  String.t() | {:error, {module(), String.t()}}

The file contain these configs

defmodule AhramSchoolWeb.Cldr do
  @moduledoc """
  Define a backend module that will host our
  Cldr configuration and public API.

  Most function calls in Cldr will be calls
  to functions on this module.
  """
  use Cldr,
    default_locale: "ar",
    providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime],
    add_fallback_locales: true,
    gettext: AhramSchoolWeb.Gettext,
    otp_app: :ahram_school,
    precompile_transliterations: [{:latn, :arab}, {:arab, :latn}],
    precompile_number_formats: ["#,##0.00 ¤", "¤#,##0.00"]
end

and config.exs contains this:

config :ex_cldr,
  default_locale: "ar",
  default_backend: AhramSchoolWeb.Cldr,
  json_library: Jason

I don't know what I configured wrong, and the same configuration I used before but with elixir 1.12.3

Thanks a lot 🙂

kipcole9 commented 2 years ago

Thans for the report, and sorry for the inconvenience. I ensure there are no dialyzer warnings before I publish a release but there are cases that crop up because my tests don't exercise every corner case and dialyser itself sometimes does things that no human can properly understand :-)

Anyway, I'll work on fixing this issue as quickly as I can but I'm travelling this week and it may take until the weekend to get a new release out the door (I'll try to be earlier though).

alaadahmed commented 2 years ago

Please take your time, it's OK for me to wait till next week or more even. I just saw warning and reported, but at the moment it doesn't bother my app. Thank you 🙂

alaadahmed commented 2 years ago

I am closing this issue, I don't have warnings anymore since updating ex_cldr_numbers. Thanks a lot ☺️

kipcole9 commented 2 years ago

Sorry it took so long @alaadahmed - but happy that in this case dialyzer actually pinpointed a bug, rather than just making noise :-)