From 5ad517025e6e502d5e34f0dc90638b819207946a Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 23 Jan 2019 15:06:42 +0100 Subject: [PATCH] fix #923: setting ans to a expression in REPLBlocks. --- src/Expanders.jl | 2 +- test/examples/src/index.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Expanders.jl b/src/Expanders.jl index 90a02816cd0..b26ffaf426f 100644 --- a/src/Expanders.jl +++ b/src/Expanders.jl @@ -547,7 +547,7 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc) input = droplines(str) (value, success, backtrace, text) = Utilities.withoutput() do cd(dirname(page.build)) do - Core.eval(mod, :(ans = $(Core.eval(mod, ex)))) + Core.eval(mod, Expr(:(=), :ans, ex)) end end result = value diff --git a/test/examples/src/index.md b/test/examples/src/index.md index a944153ec9a..6cc2765b69c 100644 --- a/test/examples/src/index.md +++ b/test/examples/src/index.md @@ -351,6 +351,11 @@ ex = :(1 + 5) eval(ex) ``` +```@example +a = 1 +:(a + 1) +``` + # Issue #793 ```jldoctest julia> write("issue793.jl", "\"Hello!\"");