Skip to content

Commit

Permalink
Fix Cartesian.exprresolve for change in conditional parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored and mfasi committed Sep 5, 2016
1 parent 194c7ec commit fab2c2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions base/cartesian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ end
function lreplace!(ex::Expr, r::LReplace)
# Curly-brace notation, which acts like parentheses
if ex.head == :curly && length(ex.args) == 2 && isa(ex.args[1], Symbol) && endswith(string(ex.args[1]), "_")
excurly = Base.Cartesian.exprresolve(lreplace!(ex.args[2], r))
excurly = exprresolve(lreplace!(ex.args[2], r))
if isa(excurly, Number)
return Symbol(ex.args[1],excurly)
else
Expand Down Expand Up @@ -369,8 +369,8 @@ exprresolve_arith(arg) = false, 0

exprresolve_conditional(b::Bool) = true, b
function exprresolve_conditional(ex::Expr)
if ex.head == :comparison && isa(ex.args[1], Number) && isa(ex.args[3], Number)
return true, exprresolve_cond_dict[ex.args[2]](ex.args[1], ex.args[3])
if ex.head == :call && ex.args[1] keys(exprresolve_cond_dict) && isa(ex.args[2], Number) && isa(ex.args[3], Number)
return true, exprresolve_cond_dict[ex.args[1]](ex.args[2], ex.args[3])
end
false, false
end
Expand Down
3 changes: 3 additions & 0 deletions test/cartesian.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@test Base.Cartesian.exprresolve(:(1 + 3)) == 4
ex = Base.Cartesian.exprresolve(:(if 5 > 4; :x; else :y; end))
@test ex.args[2] == QuoteNode(:x)
2 changes: 1 addition & 1 deletion test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function choosetests(choices = [])
"markdown", "base64", "serialize", "misc", "threads",
"enums", "cmdlineargs", "i18n", "workspace", "libdl", "int",
"checked", "intset", "floatfuncs", "compile", "parallel", "inline",
"boundscheck", "error", "ambiguous", "offsetarray"
"boundscheck", "error", "ambiguous", "offsetarray", "cartesian"
]

if Base.USE_GPL_LIBS
Expand Down

0 comments on commit fab2c2a

Please sign in to comment.