cldr icon indicating copy to clipboard operation
cldr copied to clipboard

Dialyzer: overlapping domains when adding ex_cldr_calendars

Open ptitfred opened this issue 1 year ago • 9 comments

When adding duration formatting to an existing elixir application, I've encountered this dialyzer error:

lib/cldr.ex:1:overlapping_contract
Overloaded contract for Transport.Cldr.Calendar.localize/3 has
overlapping domains; such contracts are currently unsupported and
are simply ignored.

The lib/cldr.ex module is defined here, following closely the instructions as you can see.

I've tried disabling this rule without any luck, and in last resort I've disabled the whole module in the .dializer_ignore.exs file.

If needed, here are the pinned dependencies related to cldr:

  • cldr_utils: 2.28.0 e7ac4bce
  • ex_cldr: 2.40.0 113394b6
  • ex_cldr_calendars: 1.26.2 b689847f
  • ex_cldr_currencies: 2.16.2 2ccfac28
  • ex_cldr_lists: 2.11.1 00161c04
  • ex_cldr_numbers: 2.33.2 49f1dbad
  • ex_cldr_units: 3.17.2 457d76c6

Please let me know if I can help you with it, or if I can test some fix attempt later on.

Cheers

ptitfred avatar Sep 17 '24 16:09 ptitfred

Can you share the call to Transport.Cldr.Calendar.localize/3 that is triggering this warning? I have a number of calls to that function in my test environment specifically because there used to be some dialyzer warnings - but that hasn't been observed in some time. That why I wonder if your specific call triggers something I've not seen before.

There are quite a few dialyzer-related improved in ex_cldr version 2.40.1 but I don't think these should be related to triggering this warning. But to be sure, perhaps you could test with that version?

kipcole9 avatar Sep 17 '24 18:09 kipcole9

Can you share the call to Transport.Cldr.Calendar.localize/3 that is triggering this warning? I have a number of calls to that function in my test environment specifically because there used to be some dialyzer warnings - but that hasn't been observed in some time. That why I wonder if your specific call triggers something I've not seen before.

That's the tricky part: we don't call it :/

There are quite a few dialyzer-related improved in ex_cldr version 2.40.1 but I don't think these should be related to triggering this warning. But to be sure, perhaps you could test with that version?

I can give it a try for sure.

ptitfred avatar Sep 18 '24 09:09 ptitfred

There are quite a few dialyzer-related improved in ex_cldr version 2.40.1 but I don't think these should be related to triggering this warning. But to be sure, perhaps you could test with that version?

It didn't solve it I'm afraid.

ptitfred avatar Sep 18 '24 09:09 ptitfred

Hmmm, I'm a bit out of ideas. The primary consumer of MyApp.Cldr.Calendar.localize/3 is ex_cldr_dates_times but that's not a library you are using.

Can you think of anything you ex_cldr_calendars you are using that would ultimately localise the name of months or days? I know thats not a lot of guidance but I'm out of ideas.

One last thought, can you share what flags you are setting for dialyzer? I am testing with:

        flags: [
          :error_handling,
          :unknown,
          :underspecs,
          :extra_return,
          :missing_return
        ]

but perhaps you have a broader configuration?

kipcole9 avatar Sep 18 '24 21:09 kipcole9

Ping @ptitfred ?

kipcole9 avatar Sep 23 '24 22:09 kipcole9

Ping @ptitfred ?

Sorry, my GitHub notifications were mis configured. Let me get back to you later today.

ptitfred avatar Sep 24 '24 10:09 ptitfred

Can you think of anything you ex_cldr_calendars you are using that would ultimately localise the name of months or days? I know thats not a lot of guidance but I'm out of ideas.

That's the tricky part: we weren't using it before it. I'm out of ideas as well :/

One last thought, can you share what flags you are setting for dialyzer? I am testing with:

No flags explicitly configured. We're using dialyxir 1.4.3.


I guess I can live with the warning being disabled for this one module.

ptitfred avatar Sep 25 '24 09:09 ptitfred

Mmmm, then I guess I'm out of ideas for now. I've done a lot of work on dialyzer, and specifically on that module and function. And I can't find a way to trigger the warning you're seeing.

I'll keep this issue open as I go through the CLDR 46 development process in October, just in case something becomes more obvious.

kipcole9 avatar Sep 25 '24 09:09 kipcole9

Thank you @kipcole9.

I'm sorry I had to report this to you. I'm ok with disabling dialyzer on this module, not a big deal.

Cheers,

ptitfred avatar Sep 26 '24 11:09 ptitfred