Skip to content

Commit 36c3f75

Browse files
committed
Fix bug in surround_context alias handling (#12830)
1 parent bdaffc3 commit 36c3f75

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/elixir/lib/code/fragment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ defmodule Code.Fragment do
753753
end
754754
end
755755

756-
defp take_alias([h | t], acc) when h in ?A..?Z or h in ?a..?z or h in ?0..9 or h == ?_,
756+
defp take_alias([h | t], acc) when h in ?A..?Z or h in ?a..?z or h in ?0..?9 or h == ?_,
757757
do: take_alias(t, [h | acc])
758758

759759
defp take_alias(rest, acc) do

lib/elixir/test/elixir/code_fragment_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,14 @@ defmodule CodeFragmentTest do
738738
end: {3, 5}
739739
}
740740
end
741+
742+
for i <- 1..11 do
743+
assert CF.surround_context("Foo.Bar.Baz.foo(bar)", {1, i}) == %{
744+
context: {:alias, ~c"Foo.Bar.Baz"},
745+
begin: {1, 1},
746+
end: {1, 12}
747+
}
748+
end
741749
end
742750

743751
test "underscored special forms" do

0 commit comments

Comments
 (0)