diff options
author | Andrea Leopardi <an.leopardi@gmail.com> | 2018-04-27 14:40:51 -0300 |
---|---|---|
committer | Andrea Leopardi <an.leopardi@gmail.com> | 2018-04-27 14:40:51 -0300 |
commit | 70e2754d086d2e779aa3bb2ce841267408ab0c46 (patch) | |
tree | 24b718a9c70acdc6b2407a3c2dd800e58c96a221 | |
parent | 62c1d04ce8faf46bfee3997d3ed0debf326743ba (diff) | |
download | elixir-al/warn-for-variables-then-equals.tar.gz |
-rw-r--r-- | lib/elixir/src/elixir_tokenizer.erl | 2 | ||||
-rw-r--r-- | lib/elixir/test/elixir/kernel/warning_test.exs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index 7dbd21096..f5f660b5f 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -547,7 +547,7 @@ maybe_warn_for_ambiguous_bang_before_equals(Kind, Atom, [$= | _], Scope, Line) - case lists:last(Identifier) of Last when Last == $!; Last == $? -> - Msg = io_lib:format("found an ~ts \"~ts\", ending with ~ts, followed by =. " + Msg = io_lib:format("found ~ts \"~ts\", ending with \"~ts\", followed by =. " "It is unclear if you mean \"~ts ~ts=\" or \"~ts =\". Please add " "a space before or after ~ts to remove the ambiguity", [What, Identifier, [Last], lists:droplast(Identifier), [Last], Identifier, [Last]]), diff --git a/lib/elixir/test/elixir/kernel/warning_test.exs b/lib/elixir/test/elixir/kernel/warning_test.exs index 23bc273af..7ecd80833 100644 --- a/lib/elixir/test/elixir/kernel/warning_test.exs +++ b/lib/elixir/test/elixir/kernel/warning_test.exs @@ -33,10 +33,10 @@ defmodule Kernel.WarningTest do test "identifier that ends in ! followed by the = operator without a space in between" do output = capture_err(fn -> Code.eval_string("foo!= 1") end) - assert output =~ "found an identifier \"foo!\", ending with !" + assert output =~ "found identifier \"foo!\", ending with !" output = capture_err(fn -> Code.eval_string(":foo!= :foo!") end) - assert output =~ "found an atom \":foo!\", ending with !" + assert output =~ "found atom \":foo!\", ending with !" end test "unused variable" do |