Skip to content

Commit d68c8d6

Browse files
committed
Unify handling of .. and ...
1 parent 52eaf14 commit d68c8d6

File tree

12 files changed

+70
-69
lines changed

12 files changed

+70
-69
lines changed

lib/elixir/lib/code/formatter.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ defmodule Code.Formatter do
478478
end
479479
end
480480

481+
# ...
482+
defp quoted_to_algebra({:..., _meta, []}, _context, state) do
483+
{"...", state}
484+
end
485+
481486
# 1..2//3
482487
defp quoted_to_algebra({:"..//", meta, [left, middle, right]}, context, state) do
483488
quoted_to_algebra({:"//", meta, [{:.., meta, [left, middle]}, right]}, context, state)

lib/elixir/lib/code/identifier.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule Code.Identifier do
1313
@spec unary_op(atom) :: {:non_associative, precedence :: pos_integer} | :error
1414
def unary_op(op) do
1515
cond do
16-
op in [:&] -> {:non_associative, 90}
16+
op in [:&, :...] -> {:non_associative, 90}
1717
op in [:!, :^, :not, :+, :-, :"~~~"] -> {:non_associative, 300}
1818
op in [:@] -> {:non_associative, 320}
1919
true -> :error

lib/elixir/lib/kernel/typespec.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,11 +917,11 @@ defmodule Kernel.Typespec do
917917
typespec({nil, [], []}, vars, caller, state)
918918
end
919919

920-
defp typespec([{:..., _, atom}], vars, caller, state) when is_atom(atom) do
920+
defp typespec([{:..., _, _}], vars, caller, state) do
921921
typespec({:nonempty_list, [], []}, vars, caller, state)
922922
end
923923

924-
defp typespec([spec, {:..., _, atom}], vars, caller, state) when is_atom(atom) do
924+
defp typespec([spec, {:..., _, _}], vars, caller, state) do
925925
typespec({:nonempty_list, [], [spec]}, vars, caller, state)
926926
end
927927

lib/elixir/lib/macro.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,8 +1966,8 @@ defmodule Macro do
19661966
def operator?(name, 1) when is_atom(name),
19671967
do: Identifier.unary_op(name) != :error
19681968

1969-
def operator?(:.., 0),
1970-
do: true
1969+
def operator?(:.., 0), do: true
1970+
def operator?(:..., 0), do: true
19711971

19721972
def operator?(name, arity) when is_atom(name) and is_integer(arity), do: false
19731973

lib/elixir/pages/references/operators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Operator | Associativity
2222
`&&` `&&&` `and` | Left
2323
`\|\|` `\|\|\|` `or` | Left
2424
`=` | Right
25-
`&` | Unary
25+
`&`, `...` | Unary
2626
`=>` (valid only inside `%{}`) | Right
2727
`\|` | Right
2828
`::` | Right

lib/elixir/src/elixir_parser.yrl

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Nonterminals
22
grammar expr_list
33
expr container_expr block_expr access_expr
44
no_parens_expr no_parens_zero_expr no_parens_one_expr no_parens_one_ambig_expr
5-
bracket_expr bracket_at_expr bracket_arg matched_expr unmatched_expr
5+
bracket_expr bracket_at_expr bracket_arg matched_expr unmatched_expr sub_matched_expr
66
unmatched_op_expr matched_op_expr no_parens_op_expr no_parens_many_expr
77
comp_op_eol at_op_eol unary_op_eol and_op_eol or_op_eol capture_op_eol
88
dual_op_eol mult_op_eol power_op_eol concat_op_eol xor_op_eol pipe_op_eol
@@ -12,8 +12,8 @@ Nonterminals
1212
list list_args open_bracket close_bracket
1313
tuple open_curly close_curly
1414
bitstring open_bit close_bit
15-
map map_op map_close map_args struct_expr struct_op
16-
assoc_op_eol assoc_expr assoc_base assoc_update assoc_update_kw assoc
15+
map map_op map_base_expr map_close map_args
16+
assoc_op_eol assoc_expr assoc_base assoc assoc_update assoc_update_kw
1717
container_args_base container_args
1818
call_args_parens_expr call_args_parens_base call_args_parens parens_call
1919
call_args_no_parens_one call_args_no_parens_ambig call_args_no_parens_expr
@@ -32,7 +32,7 @@ Terminals
3232
fn 'end' alias
3333
atom atom_quoted atom_safe atom_unsafe bin_string list_string sigil
3434
bin_heredoc list_heredoc
35-
comp_op at_op unary_op and_op or_op arrow_op match_op in_op in_match_op
35+
comp_op at_op unary_op and_op or_op arrow_op match_op in_op in_match_op ellipsis_op
3636
type_op dual_op mult_op power_op concat_op range_op xor_op pipe_op stab_op when_op
3737
capture_int capture_op assoc_op rel_op ternary_op dot_call_op
3838
'true' 'false' 'nil' 'do' eol ';' ',' '.'
@@ -65,6 +65,7 @@ Right 60 type_op_eol. %% ::
6565
Right 70 pipe_op_eol. %% |
6666
Right 80 assoc_op_eol. %% =>
6767
Nonassoc 90 capture_op_eol. %% &
68+
Nonassoc 90 ellipsis_op. %% ...
6869
Right 100 match_op_eol. %% =
6970
Left 120 or_op_eol. %% ||, |||, or
7071
Left 130 and_op_eol. %% &&, &&&, and
@@ -142,13 +143,12 @@ expr -> unmatched_expr : '$1'.
142143
%% if calls without parentheses are do blocks in particular
143144
%% segments and act accordingly.
144145
matched_expr -> matched_expr matched_op_expr : build_op('$1', '$2').
146+
matched_expr -> no_parens_one_expr : '$1'.
145147
matched_expr -> unary_op_eol matched_expr : build_unary_op('$1', '$2').
146148
matched_expr -> at_op_eol matched_expr : build_unary_op('$1', '$2').
147149
matched_expr -> capture_op_eol matched_expr : build_unary_op('$1', '$2').
148-
matched_expr -> no_parens_one_expr : '$1'.
149-
matched_expr -> no_parens_zero_expr : '$1'.
150-
matched_expr -> access_expr : '$1'.
151-
matched_expr -> access_expr kw_identifier : error_invalid_kw_identifier('$2').
150+
matched_expr -> ellipsis_op matched_expr : build_unary_op('$1', '$2').
151+
matched_expr -> sub_matched_expr : '$1'.
152152

153153
unmatched_expr -> matched_expr unmatched_op_expr : build_op('$1', '$2').
154154
unmatched_expr -> unmatched_expr matched_op_expr : build_op('$1', '$2').
@@ -157,12 +157,14 @@ unmatched_expr -> unmatched_expr no_parens_op_expr : warn_no_parens_after_do_op(
157157
unmatched_expr -> unary_op_eol expr : build_unary_op('$1', '$2').
158158
unmatched_expr -> at_op_eol expr : build_unary_op('$1', '$2').
159159
unmatched_expr -> capture_op_eol expr : build_unary_op('$1', '$2').
160+
unmatched_expr -> ellipsis_op expr : build_unary_op('$1', '$2').
160161
unmatched_expr -> block_expr : '$1'.
161162

162163
no_parens_expr -> matched_expr no_parens_op_expr : build_op('$1', '$2').
163164
no_parens_expr -> unary_op_eol no_parens_expr : build_unary_op('$1', '$2').
164165
no_parens_expr -> at_op_eol no_parens_expr : build_unary_op('$1', '$2').
165166
no_parens_expr -> capture_op_eol no_parens_expr : build_unary_op('$1', '$2').
167+
no_parens_expr -> ellipsis_op no_parens_expr : build_unary_op('$1', '$2').
166168
no_parens_expr -> no_parens_one_ambig_expr : '$1'.
167169
no_parens_expr -> no_parens_many_expr : '$1'.
168170

@@ -246,6 +248,12 @@ no_parens_one_expr -> dot_identifier call_args_no_parens_one : build_no_parens('
246248
no_parens_zero_expr -> dot_do_identifier : build_no_parens('$1', nil).
247249
no_parens_zero_expr -> dot_identifier : build_no_parens('$1', nil).
248250

251+
sub_matched_expr -> no_parens_zero_expr : '$1'.
252+
sub_matched_expr -> range_op : build_nullary_op('$1').
253+
sub_matched_expr -> ellipsis_op : build_nullary_op('$1').
254+
sub_matched_expr -> access_expr : '$1'.
255+
sub_matched_expr -> access_expr kw_identifier : error_invalid_kw_identifier('$2').
256+
249257
%% From this point on, we just have constructs that can be
250258
%% used with the access syntax. Note that (dot_)identifier
251259
%% is not included in this list simply because the tokenizer
@@ -281,7 +289,6 @@ access_expr -> atom_safe : build_quoted_atom('$1', true, delimiter(<<$">>)).
281289
access_expr -> atom_unsafe : build_quoted_atom('$1', false, delimiter(<<$">>)).
282290
access_expr -> dot_alias : '$1'.
283291
access_expr -> parens_call : '$1'.
284-
access_expr -> range_op : build_nullary_op('$1').
285292

286293
%% Also used by maps and structs
287294
parens_call -> dot_call_identifier call_args_parens : build_parens('$1', '$2', {[], []}).
@@ -598,16 +605,19 @@ bitstring -> open_bit container_args close_bit : build_bit('$1', '$2', '$3').
598605

599606
% Map and structs
600607

608+
map_base_expr -> sub_matched_expr : '$1'.
609+
map_base_expr -> at_op_eol map_base_expr : build_unary_op('$1', '$2').
610+
map_base_expr -> unary_op_eol map_base_expr : build_unary_op('$1', '$2').
611+
map_base_expr -> ellipsis_op map_base_expr : build_unary_op('$1', '$2').
612+
601613
assoc_op_eol -> assoc_op : '$1'.
602614
assoc_op_eol -> assoc_op eol : '$1'.
603615

604616
assoc_expr -> matched_expr assoc_op_eol matched_expr : {'$1', '$3'}.
605617
assoc_expr -> unmatched_expr assoc_op_eol unmatched_expr : {'$1', '$3'}.
606618
assoc_expr -> matched_expr assoc_op_eol unmatched_expr : {'$1', '$3'}.
607619
assoc_expr -> unmatched_expr assoc_op_eol matched_expr : {'$1', '$3'}.
608-
assoc_expr -> dot_identifier : build_identifier('$1', nil).
609-
assoc_expr -> no_parens_one_expr : '$1'.
610-
assoc_expr -> parens_call : '$1'.
620+
assoc_expr -> map_base_expr : '$1'.
611621

612622
assoc_update -> matched_expr pipe_op_eol assoc_expr : {'$2', '$1', ['$3']}.
613623
assoc_update -> unmatched_expr pipe_op_eol assoc_expr : {'$2', '$1', ['$3']}.
@@ -635,18 +645,9 @@ map_args -> open_curly assoc_update ',' close_curly : build_map_update('$1', '$2
635645
map_args -> open_curly assoc_update ',' map_close : build_map_update('$1', '$2', element(2, '$4'), element(1, '$4')).
636646
map_args -> open_curly assoc_update_kw close_curly : build_map_update('$1', '$2', '$3', []).
637647

638-
struct_op -> '%' : '$1'.
639-
struct_expr -> atom : handle_literal(?exprs('$1'), '$1', []).
640-
struct_expr -> atom_quoted : handle_literal(?exprs('$1'), '$1', delimiter(<<$">>)).
641-
struct_expr -> dot_alias : '$1'.
642-
struct_expr -> dot_identifier : build_identifier('$1', nil).
643-
struct_expr -> at_op_eol struct_expr : build_unary_op('$1', '$2').
644-
struct_expr -> unary_op_eol struct_expr : build_unary_op('$1', '$2').
645-
struct_expr -> parens_call : '$1'.
646-
647648
map -> map_op map_args : adjust_map_column('$2').
648-
map -> struct_op struct_expr map_args : {'%', meta_from_token('$1'), ['$2', '$3']}.
649-
map -> struct_op struct_expr eol map_args : {'%', meta_from_token('$1'), ['$2', '$4']}.
649+
map -> '%' map_base_expr map_args : {'%', meta_from_token('$1'), ['$2', '$3']}.
650+
map -> '%' map_base_expr eol map_args : {'%', meta_from_token('$1'), ['$2', '$4']}.
650651

651652
Erlang code.
652653

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
-define(pipe_op(T),
9696
T =:= $|).
9797

98+
-define(ellipsis_op3(T1, T2, T3),
99+
T1 =:= $., T2 =:= $., T3 =:= $.).
100+
98101
%% Deprecated operators
99102

100103
-define(unary_op3(T1, T2, T3),
@@ -272,8 +275,6 @@ tokenize([$' | T], Line, Column, Scope, Tokens) ->
272275
tokenize(".:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
273276
tokenize(Rest, Line, Column + 2, Scope, [{kw_identifier, {Line, Column, nil}, '.'} | Tokens]);
274277

275-
tokenize("...:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
276-
tokenize(Rest, Line, Column + 4, Scope, [{kw_identifier, {Line, Column, nil}, '...'} | Tokens]);
277278
tokenize("<<>>:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
278279
tokenize(Rest, Line, Column + 5, Scope, [{kw_identifier, {Line, Column, nil}, '<<>>'} | Tokens]);
279280
tokenize("%{}:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
@@ -287,8 +288,6 @@ tokenize("{}:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
287288
tokenize("..//:" ++ Rest, Line, Column, Scope, Tokens) when ?is_space(hd(Rest)) ->
288289
tokenize(Rest, Line, Column + 5, Scope, [{kw_identifier, {Line, Column, nil}, '..//'} | Tokens]);
289290

290-
tokenize(":..." ++ Rest, Line, Column, Scope, Tokens) ->
291-
tokenize(Rest, Line, Column + 4, Scope, [{atom, {Line, Column, nil}, '...'} | Tokens]);
292291
tokenize(":<<>>" ++ Rest, Line, Column, Scope, Tokens) ->
293292
tokenize(Rest, Line, Column + 5, Scope, [{atom, {Line, Column, nil}, '<<>>'} | Tokens]);
294293
tokenize(":%{}" ++ Rest, Line, Column, Scope, Tokens) ->
@@ -303,7 +302,7 @@ tokenize(":..//" ++ Rest, Line, Column, Scope, Tokens) ->
303302
% ## Three Token Operators
304303
tokenize([$:, T1, T2, T3 | Rest], Line, Column, Scope, Tokens) when
305304
?unary_op3(T1, T2, T3); ?comp_op3(T1, T2, T3); ?and_op3(T1, T2, T3); ?or_op3(T1, T2, T3);
306-
?arrow_op3(T1, T2, T3); ?xor_op3(T1, T2, T3); ?concat_op3(T1, T2, T3) ->
305+
?arrow_op3(T1, T2, T3); ?xor_op3(T1, T2, T3); ?concat_op3(T1, T2, T3); ?ellipsis_op3(T1, T2, T3) ->
307306
Token = {atom, {Line, Column, nil}, list_to_atom([T1, T2, T3])},
308307
tokenize(Rest, Line, Column + 4, Scope, [Token | Tokens]);
309308

@@ -331,13 +330,6 @@ tokenize([$:, T | Rest], Line, Column, Scope, Tokens) when
331330

332331
% ## Stand-alone tokens
333332

334-
%% TODO: Consider either making ... as nullary operator (same as ..)
335-
%% or deprecating it. In Elixir itself it is only used in typespecs.
336-
tokenize("..." ++ Rest, Line, Column, Scope, Tokens) ->
337-
NewScope = maybe_warn_too_many_of_same_char("...", Rest, Line, Column, Scope),
338-
Token = check_call_identifier(Line, Column, "...", '...', Rest),
339-
tokenize(Rest, Line, Column + 3, NewScope, [Token | Tokens]);
340-
341333
tokenize("=>" ++ Rest, Line, Column, Scope, Tokens) ->
342334
Token = {assoc_op, {Line, Column, previous_was_eol(Tokens)}, '=>'},
343335
tokenize(Rest, Line, Column + 2, Scope, add_token_with_eol(Token, Tokens));
@@ -357,6 +349,9 @@ tokenize("..//" ++ Rest = String, Line, Column, Scope, Tokens) ->
357349
tokenize([T1, T2, T3 | Rest], Line, Column, Scope, Tokens) when ?unary_op3(T1, T2, T3) ->
358350
handle_unary_op(Rest, Line, Column, unary_op, 3, list_to_atom([T1, T2, T3]), Scope, Tokens);
359351

352+
tokenize([T1, T2, T3 | Rest], Line, Column, Scope, Tokens) when ?ellipsis_op3(T1, T2, T3) ->
353+
handle_unary_op(Rest, Line, Column, ellipsis_op, 3, list_to_atom([T1, T2, T3]), Scope, Tokens);
354+
360355
tokenize([T1, T2, T3 | Rest], Line, Column, Scope, Tokens) when ?comp_op3(T1, T2, T3) ->
361356
handle_op(Rest, Line, Column, comp_op, 3, list_to_atom([T1, T2, T3]), Scope, Tokens);
362357

@@ -877,7 +872,7 @@ handle_op(Rest, Line, Column, Kind, Length, Op, Scope, Tokens) ->
877872
% ## Three Token Operators
878873
handle_dot([$., T1, T2, T3 | Rest], Line, Column, DotInfo, Scope, Tokens) when
879874
?unary_op3(T1, T2, T3); ?comp_op3(T1, T2, T3); ?and_op3(T1, T2, T3); ?or_op3(T1, T2, T3);
880-
?arrow_op3(T1, T2, T3); ?xor_op3(T1, T2, T3); ?concat_op3(T1, T2, T3) ->
875+
?arrow_op3(T1, T2, T3); ?xor_op3(T1, T2, T3); ?concat_op3(T1, T2, T3); ?ellipsis_op3(T1, T2, T3) ->
881876
handle_call_identifier(Rest, Line, Column, DotInfo, 3, [T1, T2, T3], Scope, Tokens);
882877

883878
% ## Two Token Operators
@@ -1687,12 +1682,10 @@ invalid_do_with_fn_error(Prefix) ->
16871682

16881683
% TODO: Turn into an error on v2.0
16891684
maybe_warn_too_many_of_same_char([T | _] = Token, [T | _] = _Rest, Line, Column, Scope) ->
1690-
Warning =
1691-
case T of
1692-
$. -> "please use parens around \"...\" instead";
1693-
_ -> io_lib:format("please use a space between \"~ts\" and the next \"~ts\"", [Token, [T]])
1694-
end,
1695-
Message = io_lib:format("found \"~ts\" followed by \"~ts\", ~ts", [Token, [T], Warning]),
1685+
Message = io_lib:format(
1686+
"found \"~ts\" followed by \"~ts\", please use a space between \"~ts\" and the next \"~ts\"",
1687+
[Token, [T], Token, [T]]
1688+
),
16961689
prepend_warning(Line, Column, Message, Scope);
16971690
maybe_warn_too_many_of_same_char(_Token, _Rest, _Line, _Column, Scope) ->
16981691
Scope.
@@ -1826,7 +1819,7 @@ prune_tokens([{OpType, _, _} | _] = Tokens, [], Terminators)
18261819
OpType =:= in_match_op; OpType =:= type_op; OpType =:= dual_op; OpType =:= mult_op;
18271820
OpType =:= power_op; OpType =:= concat_op; OpType =:= range_op; OpType =:= xor_op;
18281821
OpType =:= pipe_op; OpType =:= stab_op; OpType =:= when_op; OpType =:= assoc_op;
1829-
OpType =:= rel_op; OpType =:= ternary_op; OpType =:= capture_op ->
1822+
OpType =:= rel_op; OpType =:= ternary_op; OpType =:= capture_op; OpType =:= ellipsis_op ->
18301823
{Tokens, Terminators};
18311824
%%% or we traverse until the end.
18321825
prune_tokens([_ | Tokens], Opener, Terminators) ->

lib/elixir/test/elixir/kernel/parallel_compiler_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ defmodule Kernel.ParallelCompilerTest do
387387

388388
capture_io(:stderr, fn ->
389389
fixtures = [foo, bar]
390-
assert assert {:ok, modules, []} = Kernel.ParallelCompiler.compile(fixtures)
390+
assert {:ok, modules, []} = Kernel.ParallelCompiler.compile(fixtures)
391391
assert FooAsync in modules
392392
assert BarAsync in modules
393393
end)

lib/elixir/test/elixir/kernel/parser_test.exs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ defmodule Kernel.ParserTest do
66
describe "nullary ops" do
77
test "in expressions" do
88
assert parse!("..") == {:.., [line: 1], []}
9+
assert parse!("...") == {:..., [line: 1], []}
910
end
1011

11-
test "raises on ambiguous uses" do
12+
test "in capture" do
13+
assert parse!("&../0") == {:&, [line: 1], [{:/, [line: 1], [{:.., [line: 1], nil}, 0]}]}
14+
assert parse!("&.../0") == {:&, [line: 1], [{:/, [line: 1], [{:..., [line: 1], nil}, 0]}]}
15+
end
16+
17+
test "raises on ambiguous uses when also binary" do
1218
assert_raise SyntaxError, ~r/syntax error before: do/, fn ->
1319
parse!("if .. do end")
1420
end
@@ -21,6 +27,16 @@ defmodule Kernel.ParserTest do
2127
assert parse!("f @: :ok") == {:f, [line: 1], [[@: :ok]]}
2228
end
2329

30+
test "in maps" do
31+
assert parse!("%{+foo, bar => bat, ...baz}") ==
32+
{:%{}, [line: 1],
33+
[
34+
{:+, [line: 1], [{:foo, [line: 1], nil}]},
35+
{{:bar, [line: 1], nil}, {:bat, [line: 1], nil}},
36+
{:..., [line: 1], [{:baz, [line: 1], nil}]}
37+
]}
38+
end
39+
2440
test "ambiguous ops in keywords" do
2541
assert parse!("f(+: :ok)") == {:f, [line: 1], [[+: :ok]]}
2642
assert parse!("f +: :ok") == {:f, [line: 1], [[+: :ok]]}
@@ -890,8 +906,7 @@ defmodule Kernel.ParserTest do
890906
end
891907

892908
test "invalid map/struct" do
893-
assert_syntax_error(["nofile:1:5:", "syntax error before: '}'"], ~c"%{:a}")
894-
assert_syntax_error(["nofile:1:11:", "syntax error before: '}'"], ~c"%{{:a, :b}}")
909+
assert_syntax_error(["nofile:1:15:", "syntax error before: '}'"], ~c"%{foo bar, baz}")
895910
assert_syntax_error(["nofile:1:8:", "syntax error before: '{'"], ~c"%{a, b}{a: :b}")
896911
end
897912

lib/elixir/test/elixir/kernel/quote_test.exs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,6 @@ defmodule Kernel.QuoteTest do
203203

204204
map = %{foo: :default}
205205
assert %{map | unquote_splicing(foo: :bar)} == %{foo: :bar}
206-
207-
assert Code.eval_string("quote do: %{unquote_splicing foo: :bar}") ==
208-
{{:%{}, [], [foo: :bar]}, []}
209-
210-
assert Code.eval_string("quote do: %{:baz => :bat, unquote_splicing foo: :bar}") ==
211-
{{:%{}, [], [{:baz, :bat}, {:foo, :bar}]}, []}
212-
213-
assert Code.eval_string("quote do: %{foo bar | baz}") ==
214-
{{:%{}, [], [{:foo, [], [{:|, [], [{:bar, [], Elixir}, {:baz, [], Elixir}]}]}]}, []}
215206
end
216207

217208
test "when" do

lib/elixir/test/elixir/kernel/warning_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ defmodule Kernel.WarningTest do
196196
test "operators formed by many of the same character followed by that character" do
197197
assert_warn_eval(
198198
[
199-
"nofile:1:11",
200-
"found \"...\" followed by \".\", please use parens around \"...\" instead"
199+
"nofile:1:12",
200+
"found \"+++\" followed by \"+\", please use a space between \"+++\" and the next \"+\""
201201
],
202-
"quote do: ....()"
202+
"quote do: 1++++1"
203203
)
204204
end
205205

lib/elixir/test/erlang/tokenizer_test.erl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ identifier_test() ->
109109
module_macro_test() ->
110110
[{identifier, {1, 1, _}, '__MODULE__'}] = tokenize("__MODULE__").
111111

112-
triple_dot_test() ->
113-
[{identifier, {1, 1, _}, '...'}] = tokenize("..."),
114-
[{'.', {1, 1, nil}}, {identifier, {1, 3, _}, '..'}] = tokenize(". ..").
115-
116112
dot_test() ->
117113
[{identifier, {1, 1, _}, foo},
118114
{'.', {1, 4, nil}},

0 commit comments

Comments
 (0)