Skip to content

Commit dec8c53

Browse files
authored
Merge pull request #318 from probcomp/20200927-marcoct-fixsml
20200927 marcoct fixsml
2 parents 93f6fc2 + 9be2d2f commit dec8c53

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/dsl/static.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,9 @@ end
185185

186186
"Parse a return line and add corresponding return node."
187187
function parse_return_line!(stmts, bindings, expr)
188-
if isa(expr, Symbol)
189-
if !haskey(bindings, expr)
190-
error("Tried to return $expr, which is not a locally bound variable")
191-
end
192-
node = bindings[expr]
193-
else
194-
name, typ = gensym("return"), QuoteNode(Any)
195-
node = parse_julia_expr!(stmts, bindings, name, expr, typ)
196-
bindings[name] = node
197-
end
188+
name, typ = gensym("return"), QuoteNode(Any)
189+
node = parse_julia_expr!(stmts, bindings, name, expr, typ)
190+
bindings[name] = node
198191
push!(stmts, :(set_return_node!(builder, $(esc(node)))))
199192
return Expr(:return, expr)
200193
end

test/dsl/dsl.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include("macros.jl")
2-
# include("dynamic_dsl.jl")
3-
# include("static_dsl.jl")
2+
include("dynamic_dsl.jl")
3+
include("static_dsl.jl")

test/dsl/static_dsl.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,18 @@ load_generated_functions()
500500

501501
end
502502

503+
@testset "'return nothing'" begin
504+
505+
@gen (static) function foo()
506+
return nothing
507+
end
508+
509+
load_generated_functions()
510+
511+
@test foo() == nothing
512+
513+
end
514+
503515
@testset "getindex(trace)" begin
504516

505517
@gen (static) function bar(r)

0 commit comments

Comments
 (0)