Skip to content

Formatting: add white space after comma #4491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/eex/test/eex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule EExTest do
end

test "evaluates with parentheses after end in end token" do
assert_eval " 101 102 103 ", "<%= Enum.map([1,2,3], (fn x -> %> <%= 100 + x %> <% end) ) %>"
assert_eval " 101 102 103 ", "<%= Enum.map([1, 2, 3], (fn x -> %> <%= 100 + x %> <% end) ) %>"
end

test "evaluates with defined variable" do
Expand Down
6 changes: 3 additions & 3 deletions lib/elixir/lib/code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ defmodule Code do

## Examples

Code.load_file("eex_test.exs","../eex/test") |> List.first
Code.load_file("eex_test.exs", "../eex/test") |> List.first
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}

"""
Expand Down Expand Up @@ -343,11 +343,11 @@ defmodule Code do

If the code is already loaded, it returns `nil`:

Code.require_file("eex_test.exs","../eex/test") #=> nil
Code.require_file("eex_test.exs", "../eex/test") #=> nil

If the code is not loaded yet, it returns the same as `load_file/2`:

Code.require_file("eex_test.exs","../eex/test") |> List.first
Code.require_file("eex_test.exs", "../eex/test") |> List.first
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}

"""
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/lib/kernel/special_forms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ defmodule Kernel.SpecialForms do
defmodule Hygiene do
defmacrop get_length do
quote do
length([1,2,3])
length([1, 2, 3])
end
end

Expand Down Expand Up @@ -1617,7 +1617,7 @@ defmodule Kernel.SpecialForms do
evaluates to a truthy value.

cond do
hd([1,2,3]) ->
hd([1, 2, 3]) ->
"1 is considered as true"
end
#=> "1 is considered as true"
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/src/elixir_errors.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ parse_error(Line, File, <<"syntax error before: ">>, <<"{sigil,", _Rest/binary>>
true -> Content;
false -> <<>>
end,
Message = <<"syntax error before: sigil ~", Sigil," starting with content '", Content2/binary, "'">>,
Message = <<"syntax error before: sigil ~", Sigil, " starting with content '", Content2/binary, "'">>,
do_raise(Line, File, 'Elixir.SyntaxError', Message);

%% Aliases are wrapped in ['']
Expand Down
26 changes: 13 additions & 13 deletions lib/elixir/src/elixir_interpolation.erl
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,27 @@ unescape_hex(<<A, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
io:format(standard_error, "warning: \\xH inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A], Acc, 16);

unescape_hex(<<${,A,$}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
unescape_hex(<<${, A, $}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A], Acc, 16);

unescape_hex(<<${,A,B,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
unescape_hex(<<${, A, B, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A, B], Acc, 16);

unescape_hex(<<${,A,B,C,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
unescape_hex(<<${, A, B, C, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A, B, C], Acc, 16);

unescape_hex(<<${,A,B,C,D,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
unescape_hex(<<${, A, B, C, D, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);

unescape_hex(<<${,A,B,C,D,E,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
unescape_hex(<<${, A, B, C, D, E, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A, B, C, D, E], Acc, 16);

unescape_hex(<<${,A,B,C,D,E,F,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
unescape_hex(<<${, A, B, C, D, E, F, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
append_codepoint(Rest, Map, [A, B, C, D, E, F], Acc, 16);

Expand All @@ -141,25 +141,25 @@ unescape_hex(<<_/binary>>, _Map, _Acc) ->

%% Finish deprecated sequences

unescape_unicode(<<A,B,C,D, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
unescape_unicode(<<A, B, C, D, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);

unescape_unicode(<<${,A,$}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
unescape_unicode(<<${, A, $}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
append_codepoint(Rest, Map, [A], Acc, 16);

unescape_unicode(<<${,A,B,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
unescape_unicode(<<${, A, B, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
append_codepoint(Rest, Map, [A, B], Acc, 16);

unescape_unicode(<<${,A,B,C,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
unescape_unicode(<<${, A, B, C, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
append_codepoint(Rest, Map, [A, B, C], Acc, 16);

unescape_unicode(<<${,A,B,C,D,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
unescape_unicode(<<${, A, B, C, D, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);

unescape_unicode(<<${,A,B,C,D,E,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
unescape_unicode(<<${, A, B, C, D, E, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
append_codepoint(Rest, Map, [A, B, C, D, E], Acc, 16);

unescape_unicode(<<${,A,B,C,D,E,F,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
unescape_unicode(<<${, A, B, C, D, E, F, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
append_codepoint(Rest, Map, [A, B, C, D, E, F], Acc, 16);

unescape_unicode(<<_/binary>>, _Map, _Acc) ->
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/src/elixir_tokenizer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ tokenize([T|Rest], Line, Column, Scope, Tokens) when ?pipe_op(T) ->

% Others

tokenize([$%,${|T], Line, Column, Scope, Tokens) ->
tokenize([$%, ${|T], Line, Column, Scope, Tokens) ->
tokenize([${|T], Line, Column + 1, Scope, [{'%{}', {Line, Column, Column + 1}}|Tokens]);

tokenize([$%|T], Line, Column, Scope, Tokens) ->
Expand Down
6 changes: 3 additions & 3 deletions lib/elixir/src/elixir_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ get_line(Opts) when is_list(Opts) ->
get_ann(Opts) when is_list(Opts) ->
get_ann(Opts, [], 0).

get_ann([{generated,Gen}|T], Acc, Line) -> get_ann(T, [{generated,Gen}|Acc], Line);
get_ann([{line,Line}|T], Acc, _) -> get_ann(T, Acc, Line);
get_ann([{generated, Gen}|T], Acc, Line) -> get_ann(T, [{generated, Gen}|Acc], Line);
get_ann([{line, Line}|T], Acc, _) -> get_ann(T, Acc, Line);
get_ann([_|T], Acc, Line) -> get_ann(T, Acc, Line);
get_ann([], [], Line) -> Line;
get_ann([], Acc, Line) -> [{location,Line}|Acc].
get_ann([], Acc, Line) -> [{location, Line}|Acc].

split_last([]) -> {[], []};
split_last(List) -> split_last(List, []).
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/test/elixir/enum_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ defmodule EnumTest do
assert Enum.into(%{a: 1, b: 2}, []) == [a: 1, b: 2]
assert Enum.into([1, 2, 3], "numbers: ", &to_string/1) == "numbers: 123"
assert Enum.into(1..3, []) == [1, 2, 3]
assert Enum.into(["H","i"], "") == "Hi"
assert Enum.into(["H", "i"], "") == "Hi"
assert_raise FunctionClauseError, fn ->
Enum.into([2, 3], %{}, &(&1))
end
Expand Down
34 changes: 17 additions & 17 deletions lib/elixir/test/elixir/file_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ defmodule FileTest do
#
# Renaming files
# :ok -> rename file to existing file default behaviour
# {:error,:eisdir} -> rename file to existing empty dir
# {:error,:eisdir} -> rename file to existing non empty dir
# {:error, :eisdir} -> rename file to existing empty dir
# {:error, :eisdir} -> rename file to existing non empty dir
# :ok -> rename file to non existing location
# {:error,:eexist} -> rename file to existing file
# {:error, :eexist} -> rename file to existing file
# :ok -> rename file to itself

# Renaming dirs
# {:error,:enotdir} -> rename dir to existing file
# :ok -> rename dir to non existing leaf location
# {:error,??} -> rename dir to non existing parent location
# :ok -> rename dir to itself
# :ok -> rename dir to existing empty dir default behaviour
# {:error,:eexist} -> rename dir to existing empty dir
# {:error, :einval} -> rename parent dir to existing sub dir
# {:error, :einval} -> rename parent dir to non existing sub dir
# {:error,:eexist} -> rename dir to existing non empty dir
# {:error, :enotdir} -> rename dir to existing file
# :ok -> rename dir to non existing leaf location
# {:error, ??} -> rename dir to non existing parent location
# :ok -> rename dir to itself
# :ok -> rename dir to existing empty dir default behaviour
# {:error, :eexist} -> rename dir to existing empty dir
# {:error, :einval} -> rename parent dir to existing sub dir
# {:error, :einval} -> rename parent dir to non existing sub dir
# {:error, :eexist} -> rename dir to existing non empty dir

# other tests
# {:error, :enoent} -> rename unknown source
Expand Down Expand Up @@ -70,7 +70,7 @@ defmodule FileTest do

try do
File.mkdir(dest)
assert File.rename(src, dest) == {:error,:eisdir}
assert File.rename(src, dest) == {:error, :eisdir}
assert File.exists?(src)
refute File.exists?(tmp_path("tmp/file.txt"))
after
Expand All @@ -84,8 +84,8 @@ defmodule FileTest do
dest = tmp_path("tmp")

try do
File.mkdir_p(Path.join(dest,"a"))
assert File.rename(src, dest) == {:error,:eisdir}
File.mkdir_p(Path.join(dest, "a"))
assert File.rename(src, dest) == {:error, :eisdir}
assert File.exists?(src)
refute File.exists?(Path.join(dest, "file.txt"))
after
Expand Down Expand Up @@ -293,7 +293,7 @@ defmodule FileTest do
assert File.exists?(src)
refute File.exists?(tmp_path("tmp/a"))

assert File.rename(src, dest) == {:error,:eexist}
assert File.rename(src, dest) == {:error, :eexist}

assert File.exists?(tmp_path("tmp/x"))
assert File.exists?(src)
Expand Down Expand Up @@ -333,7 +333,7 @@ defmodule FileTest do
def tmp_fixture_path(extra) do
src = fixture_path(extra)
dest = tmp_path(extra)
File.cp_r(src,dest)
File.cp_r(src, dest)
dest
end
end
Expand Down
22 changes: 11 additions & 11 deletions lib/elixir/test/erlang/string_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,51 +28,51 @@ extract_interpolations_with_escaped_interpolation_test() ->

extract_interpolations_with_interpolation_test() ->
[<<"f">>,
{{1,2,7}, [{atom, {1,4,6}, o}]},
{{1, 2, 7}, [{atom, {1, 4, 6}, o}]},
<<"o">>] = extract_interpolations("f#{:o}o").

extract_interpolations_with_two_interpolations_test() ->
[<<"f">>,
{{1,2,7}, [{atom, {1,4,6}, o}]}, {{1,7,12}, [{atom, {1,9,11}, o}]},
{{1, 2, 7}, [{atom, {1, 4, 6}, o}]}, {{1, 7, 12}, [{atom, {1, 9, 11}, o}]},
<<"o">>] = extract_interpolations("f#{:o}#{:o}o").

extract_interpolations_with_only_two_interpolations_test() ->
[{{1,1,6}, [{atom, {1,3,5}, o}]},
{{1,6,11}, [{atom, {1,8,10}, o}]}] = extract_interpolations("#{:o}#{:o}").
[{{1, 1, 6}, [{atom, {1, 3, 5}, o}]},
{{1, 6, 11}, [{atom, {1, 8, 10}, o}]}] = extract_interpolations("#{:o}#{:o}").

extract_interpolations_with_tuple_inside_interpolation_test() ->
[<<"f">>,
{{1,2,8}, [{'{', {1,4,5}}, {number, {1,5,6}, 1}, {'}', {1,6,7}}]},
{{1, 2, 8}, [{'{', {1, 4, 5}}, {number, {1, 5, 6}, 1}, {'}', {1, 6, 7}}]},
<<"o">>] = extract_interpolations("f#{{1}}o").

extract_interpolations_with_many_expressions_inside_interpolation_test() ->
[<<"f">>,
{{1,2,3}, [{number, {1,4,5}, 1}, {eol, {1,5,6}}, {number, {2,1,2}, 2}]},
{{1, 2, 3}, [{number, {1, 4, 5}, 1}, {eol, {1, 5, 6}}, {number, {2, 1, 2}, 2}]},
<<"o">>] = extract_interpolations("f#{1\n2}o").

extract_interpolations_with_right_curly_inside_string_inside_interpolation_test() ->
[<<"f">>,
{{1,2,10}, [{bin_string, {1,4,9}, [<<"f}o">>]}]},
{{1, 2, 10}, [{bin_string, {1, 4, 9}, [<<"f}o">>]}]},
<<"o">>] = extract_interpolations("f#{\"f}o\"}o").

extract_interpolations_with_left_curly_inside_string_inside_interpolation_test() ->
[<<"f">>,
{{1,2,10}, [{bin_string, {1,4,9}, [<<"f{o">>]}]},
{{1, 2, 10}, [{bin_string, {1, 4, 9}, [<<"f{o">>]}]},
<<"o">>] = extract_interpolations("f#{\"f{o\"}o").

extract_interpolations_with_escaped_quote_inside_string_inside_interpolation_test() ->
[<<"f">>,
{{1,2,11}, [{bin_string, {1,4,10}, [<<"f\"o">>]}]},
{{1, 2, 11}, [{bin_string, {1, 4, 10}, [<<"f\"o">>]}]},
<<"o">>] = extract_interpolations("f#{\"f\\\"o\"}o").

extract_interpolations_with_less_than_operation_inside_interpolation_test() ->
[<<"f">>,
{{1,2,8}, [{number, {1,4,5}, 1}, {rel_op, {1,5,6}, '<'}, {number, {1,6,7}, 2}]},
{{1, 2, 8}, [{number, {1, 4, 5}, 1}, {rel_op, {1, 5, 6}, '<'}, {number, {1, 6, 7}, 2}]},
<<"o">>] = extract_interpolations("f#{1<2}o").

extract_interpolations_with_an_escaped_character_test() ->
[<<"f">>,
{{1,2,17}, [{char, {1,4,7}, 7}, {rel_op, {1,8,9}, '>'}, {char, {1,10,13}, 7}]}
{{1, 2, 17}, [{char, {1, 4, 7}, 7}, {rel_op, {1, 8, 9}, '>'}, {char, {1, 10, 13}, 7}]}
] = extract_interpolations("f#{?\\a > ?\\a }").

extract_interpolations_with_invalid_expression_inside_interpolation_test() ->
Expand Down
Loading