Skip to content

Commit 2350e83

Browse files
committed
Update ... to an operator in Code.Fragment
1 parent 677e1ec commit 2350e83

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/elixir/lib/code/fragment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ defmodule Code.Fragment do
335335
end
336336

337337
defp identifier_to_cursor_context([?., ?., ?: | _], n, _), do: {{:unquoted_atom, ~c".."}, n + 3}
338-
defp identifier_to_cursor_context([?., ?., ?. | _], n, _), do: {{:local_or_var, ~c"..."}, n + 3}
338+
defp identifier_to_cursor_context([?., ?., ?. | _], n, _), do: {{:operator, ~c"..."}, n + 3}
339339
defp identifier_to_cursor_context([?., ?: | _], n, _), do: {{:unquoted_atom, ~c"."}, n + 2}
340340
defp identifier_to_cursor_context([?., ?. | _], n, _), do: {{:operator, ~c".."}, n + 2}
341341

lib/elixir/test/elixir/code_fragment_test.exs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ defmodule CodeFragmentTest do
127127
assert CF.cursor_context("hello(\t") == {:local_call, ~c"hello"}
128128
assert CF.cursor_context("hello(\n") == {:local_call, ~c"hello"}
129129
assert CF.cursor_context("hello(\r\n") == {:local_call, ~c"hello"}
130-
assert CF.cursor_context("...(") == {:local_call, ~c"..."}
131-
assert CF.cursor_context("...(\s") == {:local_call, ~c"..."}
132130
end
133131

134132
test "dot_arity" do
@@ -326,6 +324,11 @@ defmodule CodeFragmentTest do
326324
assert CF.cursor_context("<~> ") == {:operator_call, ~c"<~>"}
327325
assert CF.cursor_context(":: ") == {:operator_call, ~c"::"}
328326

327+
assert CF.cursor_context("...(") == {:operator_call, ~c"..."}
328+
assert CF.cursor_context("...(\s") == {:operator_call, ~c"..."}
329+
assert CF.cursor_context("+(") == {:operator_call, ~c"+"}
330+
assert CF.cursor_context("++(\s") == {:operator_call, ~c"++"}
331+
329332
assert CF.cursor_context("+/") == {:operator_arity, ~c"+"}
330333
assert CF.cursor_context("++/") == {:operator_arity, ~c"++"}
331334
assert CF.cursor_context("!/") == {:operator_arity, ~c"!"}

0 commit comments

Comments
 (0)