There might be a perfectly valid explanation for this, but this also surprises me. r = rand(10) f(x) = x^2 test1(r) = sum( f(x) for t in r ) test2(r) = sum( [f(x) for t in r] ) @code_warntype test1(r) # return type Any is inferred @code_warntype test2(r) # return type Float64 is inferred
g(x)::Float64 = x^2 test3(r) = sum( g(x) for t in r ) test4(r) = sum( [g(x) for t in r] ) @code_warntype test3(r) # return type Any is inferred @code_warntype test4(r) # return type Any is inferred Why would the return type annotation in g(x) (compared to f(x)) ruin inference for test4? I might be doing something stupid, but... On Thursday, September 22, 2016 at 11:30:19 PM UTC+2, Christoph Ortner wrote: > > would it maybe be possible to introduce a macro like @inbounds that > somehow turns off the check that the generator is empty? >