esl / gradient

Gradient is a static typechecker for Elixir
Apache License 2.0
436 stars 13 forks source link

Crash when scanning ex_cldr #169

Open drselump14 opened 1 year ago

drselump14 commented 1 year ago

I got these errors below when running mix gradializer on a project with ex_cldr. Is there anything I missed here?

** (FunctionClauseError) no function clause matching in :gradualizer_lib.pick_value/2

    The following arguments were given to :gradualizer_lib.pick_value/2:

        # 1
        {:type, 0, :module, []}

        # 2
        {:env, %{{:normalize_lenient_parse, 3} => [{:type, 0, :any, []}], {:known_cldr_territory, 1} => [{:type, 0, :any, []}], {:normalize_lenient_parse, 2} => [{:type, 0, :any, []}], {:put_locale, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_reference}, []]}]}, {:type, 1, :union, [{:type, 1, :tuple, [{:atom, 1, :ok}, {:remote_type, 1, [{:atom, 1, Cldr.LanguageTag}, {:atom, 1, :t}, []]}]}, {:type, 1, :tuple, [{:atom, 1, :error}, {:type, 1, :tuple, [{:type, 1, :module, []}, {:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}]}]}]}]}, []]}], {:known_gettext_locale_name, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}]}, {:type, 1, :union, [{:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}, {:atom, 1, false}]}]}, []]}], {:known_currencies, 0} => [{:type, 0, :any, []}], {:unknown_locale_names, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:type, 1, :list, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}]}]}, []]}], {:validate_calendar, 1} => [{:type, 0, :any, []}], {:default_locale, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:type, 1, :union, [{:remote_type, 1, [{:atom, 1, Cldr.LanguageTag}, {:atom, 1, :t}, []]}, {:type, 1, :no_return, []}]}]}, []]}], {:known_gettext_locale_name?, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}]}, {:type, 1, :boolean, []}]}, []]}], {:with_locale, 2} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.LanguageTag}, {:atom, 1, :t}, []]}, {:type, 1, :fun, []}]}, {:type, 1, :any, []}]}, []]}, {:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}, {:type, 1, :fun, []}]}, {:type, 1, :any, []}]}, []]}], {:ellipsis, 4} => [{:type, 0, :any, []}], {:known_locale_name, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}]}, {:type, 1, :union, [{:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}, {:atom, 1, false}]}]}, []]}], {:__cldr__, 1} => [{:type, 0, :any, []}], {:known_rbnf_locale_names, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:type, 1, :list, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}]}]}, []]}], {:quote_marks_for, 1} => [{:type, 0, :any, []}], {:known_number_systems, 0} => [{:type, 0, :any, []}], {:quote, 2} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}, {:remote_type, 1, [{:atom, 1, Keyword}, {:atom, 1, :t}, []]}]}, {:remote_type, 1, [{:atom, 1, String}, {:atom, 1, :t}, []]}]}, []]}], {:ellipsis, 1} => [{:type, 0, :any, []}], {:ellipsis_chars, 1} => [{:type, 0, :any, []}], {:default_territory, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :territory_code}, []]}]}, []]}], {:validate_locale, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:type, 1, :union, [{:remote_type, 1, [{:atom, ...}, {...}, ...]}, {:remote_type, 1, [{...}, ...]}, {:remote_type, 1, [...]}]}]}, {:type, 1, :union, [{:type, 1, :tuple, [{:atom, 1, :ok}, {:remote_type, 1, [...]}]}, {:type, 1, :tuple, [{:atom, 1, :error}, {:type, 1, ...}]}]}]}, []]}], {:validate_number_system, 1} => [{:type, 0, :any, []}], {:known_locale_name?, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}]}, {:type, 1, :boolean, []}]}, []]}], {:known_calendars, 0} => [{:type, 0, :any, []}], {:validate_territory, 1} => [{:type, 0, :any, []}], {:known_locale_names, 0} => [{:type, 0, :any, []}], {:known_territories, 0} => [{:type, 0, :any, []}], {:quote, 1} => [{:type, 0, :any, []}], {:known_gettext_locale_names, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:type, 1, :list, [{:remote_type, ...}]}]}, []]}], {:known_cldr_locale, 2} => [{:type, 0, :any, []}], {:ellipsis, 2} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{...}, ...]}, {:remote_type, 1, [{...}, ...]}]}, []]}], {:get_locale, 0} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, []}, {:remote_type, 1, [...]}]}, []]}], {:lenient_parse_map, 2} => [{:type, 0, :any, []}], {:do_validate_locale, 1} => [{:type, 0, :any, []}], {:known_number_system_types, 0} => [{:type, 0, :any, []}], {:known_rbnf_locale_name, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{...}, ...]}, []]}], {:known_rbnf_locale_name?, 1} => [{:type, 1, :bounded_fun, [{:type, 1, :fun, [...]}, []]}], {:available_locale_name?, 1} => [{:type, 0, :any, []}], {:__info__, 1} => [{:type, 1, :bounded_fun, [{:type, 1, ...}, []]}], {:validate_number_system_type, 1} => [{:type, 1, :bounded_fun, [{:type, ...}, []]}], {:validate_currency, 1} => [{:type, 0, :any, []}]}, %{}, %{}, %{module: DesignSync.Cldr, records: %{}, types: %{}}, false, false, true, [], 30, [{:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.LanguageTag}, {:atom, 1, :t}, []]}, {:type, 1, :fun, []}]}, {:type, 1, :any, []}]}, []]}, {:type, 1, :bounded_fun, [{:type, 1, :fun, [{:type, 1, :product, [{:remote_type, 1, [{:atom, 1, Cldr.Locale}, {:atom, 1, :locale_name}, []]}, {:type, 1, :fun, []}]}, {:type, 1, :any, []}]}, []]}], false}

        (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/gradualizer_lib.erl:160: :gradualizer_lib.pick_value/2
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/gradualizer_lib.erl:196: :gradualizer_lib."-pick_value/2-lc$^2/1-2-"/2
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/gradualizer_lib.erl:197: :gradualizer_lib."-pick_value/2-lc$^2/1-2-"/2
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/gradualizer_lib.erl:197: :gradualizer_lib.pick_value/2
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/gradualizer_lib.erl:154: :gradualizer_lib."-pick_values/2-lc$^0/1-0-"/2
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/typechecker.erl:3854: :typechecker.check_clauses_intersection_throw_if_seen/5
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/typechecker.erl:3792: :typechecker.check_clauses_intersection/5
    (gradualizer 0.2.0+build.1574.ref1498d17) /Users/dr_selump14/schueco-dev/repos/design_sync/deps/gradualizer/src/typechecker.erl:3706: :typechecker.check_clauses_fun/3
erszcz commented 1 year ago

Hi, @drselump14!

Thanks for the report. It's a valid report about a problem in Gradualizer, the typechecking engine that Gradient uses. We'll look into it 👍

drselump14 commented 1 year ago

Thanks @erszcz , I really appreciate it