occured to me during JuliaDiff/ChainRules.jl#717
that there are like 3 states we really care about:
- Doesn't infer at all, so infers to
Any
or some UnionAll
or abstract type
- Infers down to a small union of <4 types, so the small union optimization kicks in
- Infers down to a single concrete type
The current check_inferred
boolean doesn't allow us to distinguish case 1 from case 2.