Strange warning in 0.7

I am migrating my code to 0.7, and have the following warnings left:

WARNING: using PyPlot.axes in module Main conflicts with an existing identifier.
┌ Warning: `Array{T}(m::Int) where T` is deprecated, use `Array{T}(undef, m)` instead.
│   caller = top-level scope at none:0
└ @ Core none:0

The first warning is related to PyPlot, so I can just wait for an updated version.

But the second warning worries me a little bit, because I don’t understand where it is coming from and how to debug that.

Any idea?

How did you get it??

Well, running one of my programs. But I can’t publish it here. Getting to a MWE (minimal working example) will take some time.

Start julia with --depwarn=error, which will give you a stacktrace to the warning.

2 Likes

I have an MWE for the first warning:

using PyPlot

But this gives a warning only in Juno:

WARNING: using PyPlot.axes in module Main conflicts with an existing identifier.

So probably a problem with Juno.

Now the stacktrace of the second warning:

julia> include("analyse_flight.jl")
ERROR: LoadError: `Array{T}(m::Int) where T` is deprecated, use `Array{T}(undef, m)` instead.
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:65
 [2] Array{Analysis,N} where N(::Int64) at ./deprecated.jl:54
 [3] top-level scope at none:0
 [4] include at ./boot.jl:317 [inlined]
 [5] include_relative(::Module, ::String) at ./loading.jl:1038
 [6] include(::Module, ::String) at ./sysimg.jl:29
 [7] include(::String) at ./client.jl:398
 [8] top-level scope at none:0
in expression starting at /media/msata/uavtalk/scripts/analyse_flight.jl:75

At least a line number. The following code shows line 75 and the lines before it:

struct Analysis
    filename::String
    data::DataFrame
    start::Float64       # start time of the analysis [s]
    stop::Float64
    windspeed::Float64   # average wind speed at 10 m height in m/s
    yaw_offset::Float64  # either estimated, or from the log file
    # slice = 1:1
end

Analsis(filename, start, stop, windspeed, yaw_offset) =
        Analysis(filename, CSV.read("../log/"*filename, allowmissing=:none), start, stop, windspeed, yaw_offset)

anas = Array{Analysis}(9)

Any idea?

Ok, fixed it:

anas = Array{Analysis}(undef, 9)

Thanks for the tip with the option --depwarn=error

:slight_smile: