Skip to content

Commit 66548df

Browse files
author
José Valim
committed
Ensure we return strings on String.split based on unfold
1 parent b6a70d1 commit 66548df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/elixir/lib/string.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ defmodule String do
337337
defp parts_to_index(:infinity), do: 0
338338
defp parts_to_index(n) when is_integer(n) and n > 0, do: n
339339

340-
defp split_each(string, _pattern, _trim, 1), do: [string]
340+
defp split_each(string, _pattern, _trim, 1) when is_binary(string), do: [string]
341341
defp split_each(string, pattern, trim, count) do
342342
case do_splitter(string, pattern, trim) do
343343
{h, t} -> [h|split_each(t, pattern, trim, count - 1)]

0 commit comments

Comments
 (0)