Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try Elixir v1.18 #4930

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Try Elixir v1.18 #4930

wants to merge 3 commits into from

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Dec 21, 2024

Trying out the new type checker to see if it catches anything.

Might be worth waiting for v1.18.1 for ce?() and ee?() to work without modifications.


Also https://hexdocs.pm/elixir/1.18.0/JSON.html

"ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.33.1", "49dc6e77e6d9ad22660aaa2480a7408ad3aedfbe517e4e83e5fe3a7bf5345770", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:digital_token, "~> 0.3 or ~> 1.0", [hex: :digital_token, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.16", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "c003bfaa3fdee6bab5195f128b94038c2ce1cf4879a759eef431dd075d9a5dac"},
"ex_cldr": {:hex, :ex_cldr, "2.40.1", "c1fcb0cd9d2a70d28f4540a99f32127e7f1813e0db109d65ab29dea5337ae266", [:mix], [{:cldr_utils, "~> 2.28", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: true]}], "hexpm", "509810702e8e81991851d9426ffe6b34b48b7b9baa12922e7b3fb8f6368606f3"},
"ex_cldr_currencies": {:hex, :ex_cldr_currencies, "2.16.3", "1ec6444b5d0c0aabba5a3bc321d73f1c9c751c6add92e7fb7775ccc071d96bd8", [:mix], [{:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "4d1b5f8449fdf0ece6a2e5c7401ad8fcfde77ee6ea480bddc16e266dfa2b570c"},
"ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.33.4", "ecb06f40fc63f484a53d4ea80e1bdd6860ec44d3032f2b10b17340d34c0a13d5", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:digital_token, "~> 0.3 or ~> 1.0", [hex: :digital_token, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.16", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "d15b7e217e9e60c328e73045e51dc67d7ac5d2997247b833efab2c69b2ed06f5"},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruslandoga ruslandoga changed the title try Elixir v1.18 Try Elixir v1.18 Dec 21, 2024
@ruslandoga ruslandoga force-pushed the try-elixir-1-18 branch 7 times, most recently from 18a43e8 to 58665f3 Compare December 23, 2024 17:37
@aerosol
Copy link
Member

aerosol commented Jan 6, 2025

Might be worth waiting for v1.18.1 for ce?() and ee?() to work without modifications.

Would you mind giving more context about the issue? Either way, I don't think having to assign ce/ee should be considered a deal breaker.

@@ -112,7 +112,7 @@ defmodule Plausible.Goal do
end

defp maybe_drop_currency(changeset) do
if ee?() and get_field(changeset, :page_path) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've dropped the check entirely here?

Copy link
Contributor Author

@ruslandoga ruslandoga Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It can (probably) be left as is in the newer Elixir version. I dropped it here while fixing 1.18 warnings since it wasn't really doing anything.

@ruslandoga
Copy link
Contributor Author

ruslandoga commented Jan 6, 2025

Would you mind giving more context about the issue?

Elixir 1.18.0 warns on boolean operators since ee? and ce? return "constant" dynamic(true) or dynamic(false).

if ee?() and something do # this `and` warns
  # ...
end

Elixir 1.18.1 was said to allow this, I'll be checking it now.


UPDATE: it still warns.

    warning: the following clause will never match:

        true

    because it attempts to match on the result of:

        Plausible.ce?()

    which has type:

        dynamic(false)

    typing violation found at:
    │
 65 │         <%= if ce?() or @live_action == :register_from_invitation_form do %>
    │         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ lib/plausible_web/live/register_form.ex:65: PlausibleWeb.Live.RegisterForm.render/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants