Skip to content

depwarn warnings should show location of the problem #19686

@joshtriplett

Description

@joshtriplett

When emitting a deprecation warning, julia shows the location of a top-level function call, not the location of the code causing the depwarn. Minimal test case:

/tmp$ cat test1.jl 
include("test2.jl")

do_complex_thing(42)
/tmp$ cat test2.jl 
function do_complex_thing(x::Int)
    bool(x)
end
/tmp$ julia test1.jl 
WARNING: bool(x::Number) is deprecated, use x != 0 instead.
 in depwarn at ./deprecated.jl:73
while loading /tmp/test1.jl, in expression starting on line 3

Notice that the error message points to the call do_complex_thing(42) in test1.jl, not to the bool(x) in test2.jl. The same issue applies to other depwarns, such as WARNING: int(x) is deprecated, use Int(x) instead. and WARNING: [a] concatenation is deprecated; use collect(a) instead.

/tmp$ julia -e 'versioninfo()'
Julia Version 0.4.7
Commit ae26b25 (2016-09-18 16:17 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messagesBetter, more actionable error messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions