Skip to content

Commit 1dc6932

Browse files
authored
error for nonliterals
I believe this is the correct way to detect literals. This has hit us a few times with some unexpected IR statment
1 parent b23337a commit 1dc6932

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/codegen/forward.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ function fwd_transform!(ci, mi, nargs, N)
5858
# version.
5959
return nothing
6060
else
61-
#TODO put guard here. We really don't want to generate invalid IR
62-
# by wrapping something that isn't more or less a literal in a ZeroBundle
61+
# Fallback case, for literals.
62+
# Literals are not Exprs so error for them.
63+
if isa(stmt, Expr)
64+
error("Unexprected statement encountered. This is a bug in Diffractor. stmt=$stmt")
65+
end
6366
return Expr(:call, ZeroBundle{N}, stmt)
6467
end
6568
end

0 commit comments

Comments
 (0)