From 8def030f38df177f2dbdd9c7bd9eaebf1ad53c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 16 Jan 2026 08:37:04 +0100 Subject: [PATCH] Use type warning instead of typing violation, closes #15065 --- CHANGELOG.md | 2 +- lib/elixir/lib/module/types/apply.ex | 2 +- lib/elixir/src/elixir_errors.erl | 2 +- .../test/elixir/module/types/integration_test.exs | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af9d93fd1..79035d5929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -146,7 +146,7 @@ The code above has a type violation, which is now caught by the type system: dynamic(%{..., name: term()}) - typing violation found at: + type warning found at: │ 16 │ User.name(%{}) │ ~ diff --git a/lib/elixir/lib/module/types/apply.ex b/lib/elixir/lib/module/types/apply.ex index a1b79a22be..d0af2f1e53 100644 --- a/lib/elixir/lib/module/types/apply.ex +++ b/lib/elixir/lib/module/types/apply.ex @@ -1743,7 +1743,7 @@ defmodule Module.Types.Apply do but the #{inspect(mod)} protocol was not yet implemented \ for any type and therefore will always fail. - This warning will disappear once you define a implementation. \ + This message will disappear once you define a implementation. \ If the protocol is part of a library, you may define a dummy \ implementation for development/test. """, ""} diff --git a/lib/elixir/src/elixir_errors.erl b/lib/elixir/src/elixir_errors.erl index 53b0c557c7..9d2ceb8599 100644 --- a/lib/elixir/src/elixir_errors.erl +++ b/lib/elixir/src/elixir_errors.erl @@ -184,7 +184,7 @@ format_snippet(Severity, Position, File, Message, Snippet, Diagnostic) -> unicode:characters_to_binary(Formatted). -format_detail(#{details := #{typing_traces := _}}, Message) -> [Message | "\ntyping violation found at:"]; +format_detail(#{details := #{typing_traces := _}}, Message) -> [Message | "\ntype warning found at:"]; format_detail(_, Message) -> Message. calculate_span_length({StartLine, StartCol}, #{span := {StartLine, EndCol}}) -> EndCol - StartCol; diff --git a/lib/elixir/test/elixir/module/types/integration_test.exs b/lib/elixir/test/elixir/module/types/integration_test.exs index 81ecb9ae22..b3c5575ea5 100644 --- a/lib/elixir/test/elixir/module/types/integration_test.exs +++ b/lib/elixir/test/elixir/module/types/integration_test.exs @@ -335,7 +335,7 @@ defmodule Module.Types.IntegrationTest do """, "the 1st argument is empty (often represented as none())", """ - typing violation found at: + type warning found at: │ 2 │ def error(), do: private(raise "oops") │ ~ @@ -348,7 +348,7 @@ defmodule Module.Types.IntegrationTest do private(List.to_tuple(x)) """, """ - typing violation found at: + type warning found at: │ 3 │ def public(x), do: private(List.to_tuple(x)) │ ~ @@ -489,7 +489,7 @@ defmodule Module.Types.IntegrationTest do hint: defimpl for Range requires its callbacks to match exclusively on %Range{} - typing violation found at: + type warning found at: │ 6 │ def itself(nil), do: nil │ ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -530,9 +530,9 @@ defmodule Module.Types.IntegrationTest do but the NoImplProtocol protocol was not yet implemented for any type and therefore will always fail. - This warning will disappear once you define a implementation. If the protocol is part of a library, you may define a dummy implementation for development/test. + This message will disappear once you define a implementation. If the protocol is part of a library, you may define a dummy implementation for development/test. - typing violation found at: + type warning found at: │ 3 │ NoImplProtocol.callback(:hello) │ ~ @@ -714,7 +714,7 @@ defmodule Module.Types.IntegrationTest do :ok - typing violation found at: + type warning found at: │ 2 │ def ok(x = :ok \\ nil) do │ ~