Skip to content

Commit b18aaa0

Browse files
authored
Improve warning for charlists (#14160)
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.
1 parent 01c8202 commit b18aaa0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,10 @@ handle_strings(T, Line, Column, H, Scope, Tokens) ->
826826
NewScope =
827827
case H of
828828
$' ->
829-
Message = "single-quoted strings represent charlists. "
829+
Message = "using single-quoted strings to represent charlists is deprecated.\n"
830830
"Use ~c\"\" if you indeed want a charlist or use \"\" instead.\n"
831-
"You may run \"mix format --migrate\" to fix this warning automatically.",
831+
"You may run \"mix format --migrate\" to change all single-quoted\n"
832+
"strings to use the ~c sigil and fix this warning.",
832833
prepend_warning(Line, Column-1, Message, InterScope);
833834

834835
_ ->

0 commit comments

Comments
 (0)