Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function can_propagate_conditional(@nospecialize(rt), argtypes::Vector{Any})
return false
end
return isa(argtypes[rt.slot], Conditional) &&
is_const_bool_or_bottom(rt.thentype) && is_const_bool_or_bottom(rt.thentype)
is_const_bool_or_bottom(rt.thentype) && is_const_bool_or_bottom(rt.elsetype)
end

function propagate_conditional(rt::InterConditional, cond::Conditional)
Expand Down
14 changes: 14 additions & 0 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6544,4 +6544,18 @@ end
@test Float64 <: Base.infer_return_type(issue55548, (Int,))
@test issue55548(Int64(0)) === 1.0

# issue #60883: conditional propagation through wrapper functions
mutable struct A60883
a::Int
end
inner60883(a, b) = iszero(a.a) && !b
outer60883(a, b) = inner60883(a, b)
function issue60883()
a = A60883(0)
b = iszero(a.a)
if outer60883(a, b) else end
return b # should not be narrowed to Const(false)
end
@test issue60883() === true

end # module inference