-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Inference regression with === nothing #26417
Comments
Use isa instead of === to work an inference regression (JuliaLang/julia#26417).
Use isa instead of === to work an inference regression (JuliaLang/julia#26417).
Use isa instead of === to work an inference regression (JuliaLang/julia#26417).
Maybe related to #26339? |
Use isa instead of === to work an inference regression (JuliaLang/julia#26417).
I tried this patch, which much to my dismay does not work: --- a/base/compiler/abstractinterpretation.jl
+++ b/base/compiler/abstractinterpretation.jl
@@ -546,13 +546,15 @@ function abstract_call(@nospecialize(f), fargs::Union{Tuple{},Vector{Any}}, argt
# if doing a comparison to a singleton, consider returning a `Conditional` instead
if isa(aty, Const) && isa(b, Slot)
if isdefined(typeof(aty.val), :instance) # can only widen a if it is a singleton
- return Conditional(b, aty, typesubtract(widenconst(bty), typeof(aty.val)))
+ trueT = (isa(rt,Const) && rt.val === false) ? Bottom : aty
+ return Conditional(b, trueT, typesubtract(widenconst(bty), typeof(aty.val)))
end
return isa(rt, Const) ? rt : Conditional(b, aty, bty)
end
if isa(bty, Const) && isa(a, Slot)
if isdefined(typeof(bty.val), :instance) # same for b
- return Conditional(a, bty, typesubtract(widenconst(aty), typeof(bty.val)))
+ trueT = (isa(rt,Const) && rt.val === false) ? Bottom : bty
+ return Conditional(a, trueT, typesubtract(widenconst(aty), typeof(bty.val)))
end
return isa(rt, Const) ? rt : Conditional(a, bty, aty)
end It fails during sysimg build with:
Interestingly, even just disabling the code to return |
If I disable the
|
1e0ce67 changed the definition of |
In the meantime, I'll switch |
The code using |
FWIW I'd rather use |
The return type
f(1)
used to be inferred asInt
on 0.6.2, but on master it's inferred asUnion{Int,Nothing}
. It still works when usingisa Nothing
though.The text was updated successfully, but these errors were encountered: