Skip to content

Commit 9137fd1

Browse files
committed
Do not return context tuples on optimized eval
1 parent 5189b29 commit 9137fd1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/elixir/src/elixir.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ eval_forms(Tree, RawBinding, OE) ->
252252

253253
case Erl of
254254
{atom, _, Atom} ->
255-
{Atom, Binding, NewE};
255+
{Atom, RawBinding, NewE};
256256

257257
_ ->
258258
Exprs =

lib/elixir/test/elixir/code_test.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ defmodule CodeTest do
167167
assert Code.eval_string("two = 1 + 1") == {2, [two: 2]}
168168
end
169169

170+
test "keeps bindings on optimized evals" do
171+
assert Code.eval_string("import Enum", x: 1) == {Enum, [x: 1]}
172+
end
173+
170174
test "supports a %Macro.Env{} struct as the third argument" do
171175
assert {3, _} = Code.eval_string("a + b", [a: 1, b: 2], __ENV__)
172176
end

0 commit comments

Comments
 (0)