Skip to content

Commit 01b3a9b

Browse files
Update to Elixir 1.19 (#457)
* Update to Elixir 1.19 * Upgrade credo * Deprecate preferred_cli_env * Compiler API changes * Update to 1.19.2 * Pull elixir * Fix test after Elixir 1.15 deprecated * Upgrade dialyxir * update submodule * bump to 1.19.4 --------- Co-authored-by: Jeremie Gillet <jie.gillet@gmail.com>
1 parent 0269937 commit 01b3a9b

File tree

11 files changed

+30
-37
lines changed

11 files changed

+30
-37
lines changed

.github/workflows/elixir_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-24.04
88

99
container:
10-
image: hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223
10+
image: hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117
1111

1212
steps:
1313
- name: Install git
@@ -53,7 +53,7 @@ jobs:
5353
id: plt-cache
5454
with:
5555
path: priv/plts
56-
key: elixir:1.18.1-erlang-27.2-debian-bookworm-20241223-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-v3
56+
key: elixir:1.19.4-erlang-28.1-debian-bookworm-20251103-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-v3
5757

5858
- name: Create PLTs
5959
if: steps.plt-cache.outputs.cache-hit != 'true'

.github/workflows/elixir_test_external.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-24.04
88

99
container:
10-
image: hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223
10+
image: hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117
1111

1212
steps:
1313
- name: Install git

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.18.1-otp-27
2-
erlang 27.2
1+
elixir 1.19.4-otp-28
2+
erlang 28.1

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223 as builder
1+
FROM hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117 as builder
22

33
RUN apt-get update && \
44
apt-get install bash -y
@@ -13,7 +13,7 @@ COPY . .
1313
# Builds an escript bin/elixir_analyzer
1414
RUN ./bin/build.sh
1515

16-
FROM hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223
16+
FROM hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117
1717
COPY --from=builder /etc/passwd /etc/passwd
1818

1919
COPY --from=builder /elixir-analyzer/bin /opt/analyzer/bin

elixir

Submodule elixir updated 76 files

lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do
99
Logger.configure(level: :critical)
1010

1111
warnings =
12-
case Kernel.ParallelCompiler.compile(code_path) do
13-
{:ok, modules, warnings} ->
12+
case Kernel.ParallelCompiler.compile(code_path, return_diagnostics: true) do
13+
{:ok, modules,
14+
%{
15+
runtime_warnings: runtime_warnings,
16+
compile_warnings: compile_warnings
17+
}} ->
1418
Enum.each(modules, fn module ->
1519
:code.delete(module)
1620
:code.purge(module)
1721
end)
1822

19-
warnings
23+
compile_warnings ++ runtime_warnings
2024

2125
{:error, _errors, _warnings} ->
2226
# This should not happen, as real code is assumed to have compiled and
@@ -43,7 +47,7 @@ defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do
4347
end
4448
end
4549

46-
defp format_warning({filepath, line, warning}) do
50+
defp format_warning(%{file: filepath, position: line, message: warning}) do
4751
[_ | after_lib] = String.split(filepath, "/lib/")
4852
filepath = "lib/" <> Enum.join(after_lib)
4953

mix.exs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ defmodule ElixirAnalyzer.MixProject do
55
[
66
app: :elixir_analyzer,
77
version: "0.1.0",
8-
elixir: "~> 1.18",
8+
elixir: "~> 1.19",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,
1111
# Turn off protocol consolidation to avoid warning in analyzed code
1212
consolidate_protocols: false,
1313
deps: deps(),
1414
escript: escript(),
15-
preferred_cli_env: [
16-
# run dialyzer in test env so that files in test/support also get checked
17-
dialyzer: :test
18-
],
1915
dialyzer: [
2016
plt_core_path: "priv/plts",
2117
plt_file: {:no_warn, "priv/plts/eventstore.plt"}
@@ -36,6 +32,11 @@ defmodule ElixirAnalyzer.MixProject do
3632
]
3733
end
3834

35+
def cli do
36+
# run dialyzer in test env so that files in test/support also get checked
37+
[preferred_envs: [dialyzer: :test]]
38+
end
39+
3940
# Run "mix help compile.app" to learn about applications.
4041
def application do
4142
[
@@ -47,8 +48,8 @@ defmodule ElixirAnalyzer.MixProject do
4748
defp deps do
4849
[
4950
{:jason, "~> 1.2"},
50-
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
51-
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
51+
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
52+
{:dialyxir, "~> 1.4.7", runtime: false},
5253
{:excoveralls, "~> 0.14", only: :test}
5354
]
5455
end

mix.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
%{
22
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
33
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
4-
"credo": {:hex, :credo, "1.7.10", "6e64fe59be8da5e30a1b96273b247b5cf1cc9e336b5fd66302a64b25749ad44d", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "71fbc9a6b8be21d993deca85bf151df023a3097b01e09a2809d460348561d8cd"},
5-
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
6-
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
4+
"credo": {:hex, :credo, "1.7.13", "126a0697df6b7b71cd18c81bc92335297839a806b6f62b61d417500d1070ff4e", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "47641e6d2bbff1e241e87695b29f617f1a8f912adea34296fb10ecc3d7e9e84f"},
5+
"dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"},
6+
"erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},
77
"excoveralls": {:hex, :excoveralls, "0.18.3", "bca47a24d69a3179951f51f1db6d3ed63bca9017f476fe520eb78602d45f7756", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "746f404fcd09d5029f1b211739afb8fb8575d775b21f6a3908e7ce3e640724c6"},
8-
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
8+
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
99
"hackney": {:hex, :hackney, "1.18.1", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"},
1010
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
1111
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},

priv/plts/.keep

Whitespace-only changes.

test/elixir_analyzer/test_suite/gotta_snatch_em_all_test.exs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,13 @@ defmodule ElixirAnalyzer.ExerciseTest.GottSnatchEmAllTest do
6868

6969
@spec split_shiny_cards(collection()) :: {[card()], [card()]}
7070
def split_shiny_cards(collection) do
71-
{shiny, not_shiny} = split_with(collection, &String.starts_with?(&1, "Shiny"))
71+
{shiny, not_shiny} = MapSet.split_with(collection, &String.starts_with?(&1, "Shiny"))
7272

7373
shiny_list = shiny |> MapSet.to_list() |> Enum.sort()
7474
not_shiny_list = not_shiny |> MapSet.to_list() |> Enum.sort()
7575

7676
{shiny_list, not_shiny_list}
7777
end
78-
79-
defp split_with(mapset, predicate) do
80-
init = {MapSet.new(), MapSet.new()}
81-
82-
Enum.reduce(mapset, init, fn item, {passes, fails} ->
83-
if predicate.(item) do
84-
{MapSet.put(passes, item), fails}
85-
else
86-
{passes, MapSet.put(fails, item)}
87-
end
88-
end)
89-
end
9078
end
9179
end
9280

0 commit comments

Comments
 (0)