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

Mysterious inference failure #19270

Closed
nalimilan opened this issue Nov 8, 2016 · 1 comment
Closed

Mysterious inference failure #19270

nalimilan opened this issue Nov 8, 2016 · 1 comment
Labels
compiler:inference Type inference

Comments

@nalimilan
Copy link
Member

This bug has appeared in the last few days on master. Depending on the order in which you call f and g, you get different results. In all cases, the Any result is unexpected and didn't happen before.

First call order:

julia> f{S,T}(x::S, y::T) = Base.promote_op(^, S, T)
f (generic function with 1 method)

julia> f(Nullable(0.0f0), Nullable(BigInt(0)))
Nullable{Any}

julia> g{S,T}(x::Nullable{S}, y::Nullable{T}) = Base.promote_op(^, S, T)
g (generic function with 1 method)

julia> g(Nullable(0.0f0), Nullable(BigInt(0)))
Float32

Second call order:

julia> g{S,T}(x::Nullable{S}, y::Nullable{T}) = Base.promote_op(^, S, T)
g (generic function with 1 method)

julia> g(Nullable(0.0f0), Nullable(BigInt(0)))
Any

julia> f{S,T}(x::S, y::T) = Base.promote_op(^, S, T)
f (generic function with 1 method)

julia> f(Nullable(0.0f0), Nullable(BigInt(0)))
Nullable{Float32}
@pabloferz
Copy link
Contributor

Sorry, my fault. We need promote_op inlined in some places and I mistakenly marked as pure instead of forcing inlining. See #19273

pabloferz added a commit to pabloferz/julia that referenced this issue Nov 8, 2016
fcard pushed a commit to fcard/julia that referenced this issue Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference
Projects
None yet
Development

No branches or pull requests

2 participants