From 9eaf37181b3b34edcd6cc609523fb5d885c5cc52 Mon Sep 17 00:00:00 2001 From: Philip Munksgaard Date: Thu, 26 Oct 2023 13:56:27 +0200 Subject: [PATCH] Silence dialyzer warnings about do_plural_rule Libraries that depend on Cldr might use the `:extra_returns` feature in dialyzer, which will warn if the typespec of a function specifies return types that are not part of the success typing. My understanding is that the behavior (and therefore success typing) of `do_plural_rule depends/8` on the locale used, so we cannot accurately tell what the correct return type is. Therefore, this commit posits to silence dialyzer warnings about `do_plural_rule/8`. --- lib/cldr/plural_rules/plural_rule.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cldr/plural_rules/plural_rule.ex b/lib/cldr/plural_rules/plural_rule.ex index a1cfc86f8..d423ad866 100644 --- a/lib/cldr/plural_rules/plural_rule.ex +++ b/lib/cldr/plural_rules/plural_rule.ex @@ -665,6 +665,11 @@ defmodule Cldr.Number.PluralRule do def define_plural_rules do quote bind_quoted: [], location: :keep do alias Cldr.Number.PluralRule + + # Silence warnings since the success typing of do_plural_rule will depend + # on the locale used. + @dialyzer {:nowarn_function, [do_plural_rule: 8]} + # Generate the functions to process plural rules @spec do_plural_rule( LanguageTag.t(),