I just have a very strange bug that cannot be reproduced locally _and_ replacing === nothing with == nothing (as below) fixes this bug.
diff --git a/examples/primes.jl b/examples/primes.jl
index 7dac9d2f..0f194e7f 100644
--- a/examples/primes.jl
+++ b/examples/primes.jl
@@ -11,7 +11,7 @@ using Transducers
function sieve(xf, x)
@info "sieve(xf, x=$x)"
- if (@show mapfoldl(xf, right, (x,), init=nothing)) === nothing
+ if (@show mapfoldl(xf, right, (x,), init=nothing)) == nothing
@info "$x is NOT prime"
nothing, xf
else
See: https://travis-ci.com/tkf/Transducers.jl/builds/119090143 (Ref https://github.com/tkf/Transducers.jl/pull/17)
Maybe it's relevant to #32135?
I tried other variants:
isa Nothing works https://travis-ci.com/tkf/Transducers.jl/builds/119091015isnothing works https://travis-ci.com/tkf/Transducers.jl/builds/119092120!== x where x is not a nothing works https://travis-ci.com/tkf/Transducers.jl/builds/119092147This seems like it shouldnโt happen.
Seems like someone may have deleted the build log for the OP?
I can reproduce this locally if I try using Run.jl as in the travis script for that package.
Looks like the difference is the --code-coverage=user flag.
Looking at the IR, I see:
23 โ %44 = ฯ (#21 => false)::Bool
โ %45 = ฯ (#21 => _3, #22 => nothing)::Union{Nothing, Int64}
โโโโ goto #25
24 โ goto #25
25 โ %48 = ฯ (#23 => %44)::Bool
โ %49 = ฯ (#23 => %45, #24 => nothing)::Union{Nothing, Int64}
โโโโ goto #26
26 โ %51 = (isa)(%49, Nothing)::Bool
โโโโ goto #28 if not %51
27 โ %53 = ฯ (%49, Nothing)
โโโโ goto #31
28 โ %55 = (isa)(%49, Int64)::Bool
โโโโ goto #30 if not %55
29 โ %57 = ฯ (%49, Int64)
โโโโ goto #31
30 โ Core.throw(ErrorException("fatal error in type inference (type bound)"))::Union{}
โโโโ $(Expr(:unreachable))::Union{}
31 โ %61 = ฯ (#27 => %48, #29 => %48)::Bool
which looks like an optimizer bug, probably in type lifting.
using Run.jl
Ah, I thought I've tried this... But yes, I can reproduce it with Run.test() now.
Edit: maybe the easiest way to run the script is julia --startup-file=no --project=test --code-coverage=user examples/primes.jl
Maybe related to https://github.com/JuliaLang/julia/issues/30872?
Ref https://github.com/JuliaLang/julia/issues/32135#issuecomment-533975397 for another instance of this
Most helpful comment
This seems like it shouldnโt happen.