From cc6fa5a06512e948397f7a5a24970dcf23a6f215 Mon Sep 17 00:00:00 2001 From: Daniel Drexler Date: Wed, 8 Jan 2025 16:47:46 -0500 Subject: [PATCH] Improve warning for charlists The current warning for single-quoted character lists is confusing because it appears to be a stylistic note instead of a deprecation warning. This commit updates the language to make the reasoning clearer and to more clearly describe what `mix format --migrate` will change about the users' code. --- lib/elixir/src/elixir_tokenizer.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index dcbbf0ad948..c656052e0e3 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -826,9 +826,10 @@ handle_strings(T, Line, Column, H, Scope, Tokens) -> NewScope = case H of $' -> - Message = "single-quoted strings represent charlists. " + Message = "using single-quoted strings to represent charlists is deprecated.\n" "Use ~c\"\" if you indeed want a charlist or use \"\" instead.\n" - "You may run \"mix format --migrate\" to fix this warning automatically.", + "You may run \"mix format --migrate\" to change all single-quoted\n" + "strings to use the ~c sigil and fix this warning.", prepend_warning(Line, Column-1, Message, InterScope); _ ->