Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is wrong with inference of promote_op on Float16 #17394

Merged
merged 1 commit into from
Jul 13, 2016
Merged
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
25 changes: 21 additions & 4 deletions test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2770,7 +2770,12 @@ let types = (Base.BitInteger_types..., BigInt, Bool,
Complex{Int}, Complex{UInt}, Complex32, Complex64, Complex128)
for S in types
for op in (+, -)
T = @inferred Base.promote_op(op, S)
if S === Float16 # type instability here?
@test_broken @inferred Base.promote_op(op, S)
Copy link
Contributor Author

@tkelman tkelman Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d'oh, I am not using @test_broken correctly here

fixed in #17396

T = Base.promote_op(op, S)
else
T = @inferred Base.promote_op(op, S)
end
t = @inferred op(one(S))
@test T === typeof(t)
end
Expand All @@ -2780,8 +2785,15 @@ let types = (Base.BitInteger_types..., BigInt, Bool,

for R in types, S in types
for op in (+, -, *, /, ^)
T = @inferred Base.promote_op(op, R, S)
t = @inferred op(one(R), one(S))
if R in (Float16, Complex{Float16}) || S in (Float16, Complex{Float16})
@test_broken @inferred Base.promote_op(op, R, S)
T = Base.promote_op(op, R, S)
@test_broken @inferred op(one(R), one(S))
t = op(one(R), one(S))
else
T = @inferred Base.promote_op(op, R, S)
t = @inferred op(one(R), one(S))
end
@test T === typeof(t)
end
end
Expand All @@ -2792,7 +2804,12 @@ let types = (Base.BitInteger_types..., BigInt, Bool,
Float16, Float32, Float64, BigFloat)
for S in types, T in types
for op in (<, >, <=, >=, (==))
@test @inferred(Base.promote_op(op, S, T)) === Bool
if S === Float16 || T === Float16
@test_broken @inferred(Base.promote_op(op, S, T))
@test Base.promote_op(op, S, T) === Bool
else
@test @inferred(Base.promote_op(op, S, T)) === Bool
end
end
end
end
Expand Down