Skip to content

Type instability in parametric functions not checked #14

@ArchRobison

Description

@ArchRobison

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions