julia
77900772 - Improve generated code for typeassert with abstract type

Commit
7 years ago
Improve generated code for typeassert with abstract type The motivation is something like the following: ``` @noinline r_typeassert(c) = c ? (1,1) : nothing function f_typeassert(c) r(c)::Tuple end ``` Here, we know that the return type from r_typeassert is either `Tuple{Int, Int}` or `Nothing`, so all the type assert has to do is assert that it's the former. We can compute this by narrowing the type to be asserted using type intersection.
Author
Committer
Parents
Loading