Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type instability in parametric functions not checked #14

Open
ArchRobison opened this issue Jan 17, 2015 · 0 comments
Open

Type instability in parametric functions not checked #14

ArchRobison opened this issue Jan 17, 2015 · 0 comments

Comments

@ArchRobison
Copy link

This may be a research project to fix.

checklooptypes seems to not find any issues with the following code that uses 0 where it should use zero(T).

julia> function tally{T}( a::Vector{T} )
           s = 0
           for x in a
               s += x
           end
           s
       end
tally (generic function with 1 method)

julia> checklooptypes(tally)
TypeCheck.LoopResults(:tally,TypeCheck.LoopResult[])

Of course the type instability shows up only for certain instances of T. Maybe the module checker could check all instantiations used in the module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant