Skip to content

Commit

Permalink
fix else branch of effect_free
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jun 9, 2014
1 parent 350c8e7 commit 51c9a5b
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1925,40 +1925,29 @@ function effect_free(e::ANY, sv, allow_volatile::Bool)
return false
end
end
end
else
# arguments must also be effect_free
for a in ea
if !effect_free(a,sv,allow_volatile)
return false
end
return true
end
end
return true
end
elseif e.head === :new
first = !allow_volatile
for a in ea
if first
first = false
typ = exprtype(a)
if !isType(typ) || !isa((typ::Type).parameters[1],DataType) || ((typ::Type).parameters[1]::DataType).mutable
return false
end
end
if !effect_free(a,sv,allow_volatile)
if !allow_volatile
a = ea[1]
typ = exprtype(a)
if !isType(typ) || !isa((typ::Type).parameters[1],DataType) || ((typ::Type).parameters[1]::DataType).mutable
return false
end
end
return true
elseif e.head === :return
for a in ea
if !effect_free(a,sv,allow_volatile)
return false
end
# pass
else
return false
end
for a in ea
if !effect_free(a,sv,allow_volatile)
return false
end
return true
end
return true
end
return false
end
Expand Down

0 comments on commit 51c9a5b

Please sign in to comment.