I use this to check wether the functions in my module have a bad return 
type causing type inference problems.

That’s precisely what I suspected - for that, it is definitely isleaftype 
you want, rather than rolling your own. (The performance problems that 
Any-typed 
instances have, are intrinsic with anything that’s inferred to a 
non-leaftype, as Yichao mentioned.)

Do note that on 0.4 you can use @code_warntype to find that type of 
problems easily, i.e. if you are already running 0.4 (or if you can switch 
to the RC, or wait up to a couple of weeks), there’s no reason at all to 
roll your own tool for this.

// T

On Monday, September 21, 2015 at 2:38:01 PM UTC+2, Yichao Yu wrote:

On Mon, Sep 21, 2015 at 8:09 AM, Tommy Hofmann <[email protected] 
> <javascript:>> wrote: 
> > @Tomas: I also want contains_any(Array{Any, 2}) == 
> > contains_any(Union{Integer, Any}) == true. I tried isleaftype before but 
> > isleaftype(Integer) == isleaftype(Any) == false, i.e. I cannot 
> distinguish 
> > between abstract types and Any. 
> > 
> > @Mauro: Thanks for the T.parameters hint. This looks like the right 
> tool. 
> > 
> > I use this to check wether the functions in my module have a bad return 
> type 
> > causing type inference problems. Thus it does not have to be the fastest 
> > solution (of course I appreciate faster and more elegant solutions). 
>
> Any non-leaf type can be a type inference problem. 
>
> > 
> > Thanks for your help, 
> > Tommy 
>
​

Reply via email to