Skip to content

Conversation

@san650
Copy link

@san650 san650 commented Dec 3, 2025

I got these problems when compiling the project agains elixir v1.19.x and fixed them.

1. Remove :preferred_cli_env deprecation

warning: setting :preferred_cli_env in your mix.exs "def project" is deprecated, set it inside "def cli" instead:

    def cli do
      [preferred_envs: [coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test, "coveralls.github": :test]]
    end

  (mix 1.19.4) lib/mix/cli.ex:187: Mix.CLI.preferred_cli_env/3
  (mix 1.19.4) lib/mix/cli.ex:170: Mix.CLI.maybe_change_env_and_target/2
  (mix 1.19.4) lib/mix/cli.ex:59: Mix.CLI.proceed/2
  /Users/santiago/.asdf/installs/elixir/1.19.4-otp-28/bin/mix:7: (file)
  (elixir 1.19.4) src/elixir_compiler.erl:81: :elixir_compiler.dispatch/4
  (elixir 1.19.4) src/elixir_compiler.erl:56: :elixir_compiler.compile/4

2. Bump credo

== Compilation error in file lib/credo/check/config_comment_finder.ex ==
** (Regex.CompileError) invalid range in character class at position 16
    (elixir 1.19.4) lib/regex.ex:251: Regex.compile!/2
    (elixir 1.19.4) lib/kernel.ex:6649: Kernel.compile_regex/2
    (elixir 1.19.4) expanding macro: Kernel.sigil_r/2
    lib/credo/check/config_comment_finder.ex:9: Credo.Check.ConfigCommentFinder (module)
    (elixir 1.19.4) expanding macro: Kernel.@/1
    lib/credo/check/config_comment_finder.ex:9: Credo.Check.ConfigCommentFinder (module)
could not compile dependency :credo, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile credo --force", update it with "mix deps.update credo" or clean it with "mix deps.clean credo"

3. Add Elixir v1.19 to CI matrix

So, code is tested agains the latest version of Elixir

4. Remove warning for updating struct

$ mix compile
Compiling 1 file (.ex)
    warning: a struct for Ecto.Changeset is expected on struct update:

        %Ecto.Changeset{
          changeset
          | action: parent_action,
            params: params,
            errors: errors,
            valid?: errors == []
        }

    but got type:

        dynamic()

    where "changeset" was given the type:

        # type: dynamic()
        # from: lib/polymorphic_embed/html/helpers.ex:76:19
        changeset =
          apply_action(
            Ecto.Changeset.change(data),
            parent_action
          )

    when defining the variable "changeset", you must also pattern match on "%Ecto.Changeset{}".

    hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:

        user = some_function()
        %User{user | name: "John Doe"}

    it is enough to write:

        %User{} = user = some_function()
        %{user | name: "John Doe"}

    typing violation found at:
    │
 83 │         changeset = %Ecto.Changeset{
    │                     ~
    │
    └─ lib/polymorphic_embed/html/helpers.ex:83:21: PolymorphicEmbed.HTML.Helpers.to_form/4

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.

1 participant