We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01d7e21 commit 6024014Copy full SHA for 6024014
lib/elixir/src/elixir_interpolation.erl
@@ -19,8 +19,8 @@ extract(Line, _File, _Interpol, [], _Buffer, [], _Output, Last) ->
19
extract(Line, File, _Interpol, [Last|Remaining], Buffer, [], Output, Last) ->
20
finish_extraction(Line, File, Buffer, Output, Remaining);
21
22
-extract(Line, _File, _Interpol, [Last], _Buffer, Search, _Output, Last) ->
23
- { error, { Line, io_lib:format("unexpected end of string: ~ts", [[hd(Search)]]), [Last] } };
+extract(Line, _File, _Interpol, End, _Buffer, Search, _Output, Last) when End == [Last]; End == [] ->
+ { error, { Line, io_lib:format("missing terminator: ~ts", [[Last]]), [] } };
24
25
extract(Line, File, Interpol, [$\n|Rest], Buffer, Search, Output, Last) ->
26
extract(Line+1, File, Interpol, Rest, [$\n|Buffer], Search, Output, Last);
lib/elixir/test/erlang/string_test.erl
@@ -98,7 +98,8 @@ bin_string_with_escaped_interpolation_test() ->
98
{<<"f#{'o}o">>, _} = eval("\"f\\#{'o}o\"").
99
100
invalid_string_interpolation_test() ->
101
- ?assertError({'Elixir.SyntaxError', _, _, _, _}, eval("\"f#{{}o\"")).
+ ?assertError({'Elixir.TokenMissingError', _, _, _, _}, eval("\"f#{some\"")),
102
+ ?assertError({'Elixir.TokenMissingError', _, _, _, _}, eval("\"f#{1+")).
103
104
unterminated_string_interpolation_test() ->
105
?assertError({'Elixir.TokenMissingError', _, _, _, _}, eval("\"foo")).
0 commit comments