Works in Atom/Juno not in REPL

I’m in the process of updating a module I’ve been working on due to breaking changes in DataFrames. Using Pkg.test to call the tests that I had setup before the breaking changes works when I run it through the Atom/Juno console but not in REPL. In the REPL I get the following errors.

ERROR: MethodError: no method matching convert(::Type{AssertionError}, ::String)
Closest candidates are:
  convert(::Type{Any}, ::ANY) at essentials.jl:28
  convert(::Type{T}, ::T) where T at essentials.jl:29
 [1] AssertionError(::String) at ./coreimg.jl:14
 [2] update_valid_age!(::UInt64, ::UInt64, ::Core.Inference.InferenceState) at ./inference.jl:2353
 [3] abstract_call_gf_by_type(::Any, ::Any, ::Core.Inference.InferenceState) at ./inference.jl:1431
 [4] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1897
 [5] abstract_eval_call(::Expr, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1927
 [6] abstract_eval(::Any, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1950
 [7] abstract_interpret(::Any, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:2076
 [8] typeinf_work(::Core.Inference.InferenceState) at ./inference.jl:2669
 [9] typeinf(::Core.Inference.InferenceState) at ./inference.jl:2787
 [10] typeinf_edge(::Method, ::Any, ::SimpleVector, ::Core.Inference.InferenceState) at ./inference.jl:2535
 [11] abstract_call_gf_by_type(::Any, ::Any, ::Core.Inference.InferenceState) at ./inference.jl:1420
 [12] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1897
 [13] abstract_eval_call(::Expr, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1927
 [14] abstract_eval(::Any, ::Array{Any,1}, ::Core.Inference.InferenceState) at ./inference.jl:1950
 [15] typeinf_work(::Core.Inference.InferenceState) at ./inference.jl:2722
 [16] typeinf(::Core.Inference.InferenceState) at ./inference.jl:2787
 [17] typeinf_frame(::Core.MethodInstance, ::Bool, ::Bool, ::Core.Inference.InferenceParams) at ./inference.jl:2504
 [18] typeinf_code(::Core.MethodInstance, ::Bool, ::Bool, ::Core.Inference.InferenceParams) at ./inference.jl:2583
 [19] typeinf_ext(::Core.MethodInstance, ::UInt64) at ./inference.jl:2622

I can call the function itself from the console in Atom and it works as well. What is interference.jl?

Julia 0.6.1
Commit 0d7248e2ff (2017-10-24 22:15 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core™ i5-4570 CPU @ 3.20GHz
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Dict{String,VersionNumber} with 78 entries:
  "Libz"              => v"0.2.4"
  "Juno"              => v"0.3.2"
  "Lazy"              => v"0.12.0"
  "Nullables"         => v"0.0.1"
  "ZMQ"               => v"0.5.1"
  "DataStructures"    => v"0.7.2"
  "Compat"            => v"0.39.0"
  "LNR"               => v"0.0.2"
  "CategoricalArrays" => v"0.3.0"
  "Calculus"          => v"0.2.2"
  "GZip"              => v"0.3.0"
  "Measures"          => v"0.1.0"
  "StatsFuns"         => v"0.5.0"
  "RecipesBase"       => v"0.2.3"
  "JLD2"              => v"0.0.4"
  "CodeTools"         => v"0.4.7"
  "HttpParser"        => v"0.3.0"
  "DataFrames"        => v"0.11.1"
  "SpecialFunctions"  => v"0.3.5"
  "Requires"          => v"0.4.3"
  "Blosc"             => v"0.3.0"
  "Showoff"           => v"0.1.1"
  "Distributions"     => v"0.15.0"
  "Mux"               => v"0.2.3"
  "ZipFile"           => v"0.4.0"
  "FixedPointNumbers" => v"0.4.3"
  "SHA"               => v"0.5.2"
  "Missings"          => v"0.2.2"
  "Media"             => v"0.3.0"
  "HDF5"              => v"0.8.8"
  "ColorTypes"        => v"0.6.6"
  "BufferedStreams"   => v"0.3.3"
  "MbedTLS"           => v"0.5.1"
  "DebuggerFramework" => v"0.1.2"
  "FileIO"            => v"0.6.1"
  "StringDistances"   => v"0.2.0"
  "HttpServer"        => v"0.2.0"
  "PlotThemes"        => v"0.1.4"
  "Contour"           => v"0.4.0"
  "CSV"               => v"0.2.0"
  "PDMats"            => v"0.7.1"
  "Revise"            => v"0.1.1"
  "Atom"              => v"0.6.5"
  "SortingAlgorithms" => v"0.2.0"
  "Conda"             => v"0.7.0"
  "WeakRefStrings"    => v"0.4.0"
  "Hiccup"            => v"0.1.1"
  "Gallium"           => v"0.1.0"
  "PyCall"            => v"1.15.0"
  "PlotUtils"         => v"0.4.4"
  "JSON"              => v"0.16.2"
  "DocSeeker"         => v"0.1.0"
  "StatsBase"         => v"0.19.2"
  "IJulia"            => v"1.6.2"
  "Distances"         => v"0.5.0"
  "Plots"             => v"0.13.1"
  "PyPlot"            => v"2.3.2"
  "QuadGK"            => v"0.1.3"
  "StaticArrays"      => v"0.6.6"
  "BinDeps"           => v"0.8.0"
  "Mustache"          => v"0.3.0"
  "Reexport"          => v"0.0.3"
  "NaNMath"           => v"0.3.0"
  "URIParser"         => v"0.2.0"
  "DataStreams"       => v"0.3.1"
  "Rmath"             => v"0.3.0"
  "Tokenize"          => v"0.4.2"
  "IterTools"         => v"0.1.0"
  "ASTInterpreter2"   => v"0.1.1"
  "LaTeXStrings"      => v"0.3.0"
  "PkgDev"            => v"0.1.6"
  "Blink"             => v"0.5.4"
  "Colors"            => v"0.8.2"
  "WebSockets"        => v"0.4.0"
  "MacroTools"        => v"0.4.0"
  "NamedTuples"       => v"4.0.0"
  "HttpCommon"        => v"0.3.0"
  "Codecs"            => v"0.4.0"

Atom 1.21.1 x64
language-julia 0.13.0
julia-client 0.6.6
ink 0.7.11
latex-completions 0.3.3
uber-juno 0.1.2

inference.jl is Julia’s internal implementation of type inference (the tool that figures out the correct concrete types given your method definitions and input variables). An error inside inference may indicate that you’ve found a bug in Julia itself.

Can you post a reproducible example? Ideally, one that is as short as possible?

For example, can you trigger the error by just going into the package and running: julia test/runtests.jl ? And if so, how much of the contents of runtests.jl can you remove while still seeing the error?

This same issue came up wrt julia-vscode recently

I zipped and uploaded the package. I’m not entirely sure why the failure happens but I have it down to one example. The problem file that I’ve chosen doesn’t even need to be called to trigger the error.

Comment out line 11 of runtests.jl and line 12 (the problem file) will run. Move the block comment in slt_trim.jl up one line and runtests.jl finishes with both lines 11 and 12 being run.

The “problem” chunk of code in slt_trim.jl is nothing special. files is an array of strings of file paths and fdates is an array of DateTime corresponding to each file.

# Sort Files by Type
f = [ismatch(r"\.slt$",i) for i in files]
sltfiles = files[f]
sltdates = fdates[f]
f = [ismatch(r"\.csr$",i) for i in files]
csrfiles = files[f]
csrdates = fdates[f]
f = [ismatch(r"\.csu$",i) for i in files]#=
csufiles = files[f]
csudates = fdates[f]
f = [ismatch(r"\.flx$",i) for i in files]
flxfiles = files[f]
flxdates = fdates[f]

It makes no sense why it fails here because it just nearly the exact same code is above and blow the block comment.

Other functions in this package use this same method but I haven’t checked if they each fail at this point. As many functions as possible were commented out from the main module file.

I seem to have fixed it although I don’t know why it failed where it did :thinking:. Here is the updated module.

In short, I added return types to the function definitions. As far as I can see though the return types should have been clear. Now that it’s working I’ll keep udpating it for DataFrames 0.11 and CSV while looking out for any type instabilities.

This bit me too. Is there an issue in the tracker I can add my observations to?

Edit: I’ve noticed that I only have this error when I start my session with using Revise. I cleared out my ./julia/v0.6 folder and reinstalled packages and still get the error. The Revise workflow was working for me before today which what led be to believe that newly-installed Juno was the problem but now I’m starting to doubt that.

I couldn’t narrow it down enough to open an issue. It still confuses me but it’s been solved and I don’t have enough time to really dig down and find the exact reason.

I am hitting this bug. I am on Julia v0.6.3. The error with the long stack trace seem to appear randomly. For tests it is pretty consistent.

Is there anything I can do at the moment to function despite this bug? Can I modify my code somehow to avoid this error?

In case someone else is running into this bug with Julia v0.6.3. A quick and dirty way to get your code running is to use the option julia --compilecache=no. Thans to @omus.

This is already resolved in v0.7, and should be be resolved (sooner) in v0.6.4.