Skip to content

Commit defef37

Browse files
aeturnumjosevalim
authored andcommitted
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 432d6fa commit defef37

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
@@ -818,9 +818,10 @@ handle_strings(T, Line, Column, H, Scope, Tokens) ->
818818
NewScope =
819819
case H of
820820
$' ->
821-
Message = "single-quoted strings represent charlists. "
821+
Message = "using single-quoted strings to represent charlists is deprecated.\n"
822822
"Use ~c\"\" if you indeed want a charlist or use \"\" instead.\n"
823-
"You may run \"mix format --migrate\" to fix this warning automatically.",
823+
"You may run \"mix format --migrate\" to change all single-quoted\n"
824+
"strings to use the ~c sigil and fix this warning.",
824825
prepend_warning(Line, Column-1, Message, InterScope);
825826

826827
_ ->

0 commit comments

Comments
 (0)