-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
Description
Steps to reproduce:
Apply this patch to base/range.jl
on the latest Julia master:
diff --git a/base/range.jl b/base/range.jl
index 5f30a31a0b..e004161551 100644
--- a/base/range.jl
+++ b/base/range.jl
@@ -318,7 +318,7 @@ be 1.
"""
struct OneTo{T<:Integer} <: AbstractUnitRange{T}
stop::T
- OneTo{T}(stop) where {T<:Integer} = new(max(zero(T), stop))
+ OneTo{T}(stop) where {T<:Integer} = (@_inline_meta; new(max(zero(T), stop)))
function OneTo{T}(r::AbstractRange) where {T<:Integer}
throwstart(r) = (@_noinline_meta; throw(ArgumentError("first element must be 1, got $(first(r))")))
throwstep(r) = (@_noinline_meta; throw(ArgumentError("step must be 1, got $(step(r))")))
@@ -327,7 +327,7 @@ struct OneTo{T<:Integer} <: AbstractUnitRange{T}
return new(max(zero(T), last(r)))
end
end
-OneTo(stop::T) where {T<:Integer} = OneTo{T}(stop)
+OneTo(stop::T) where {T<:Integer} = (@_inline_meta; OneTo{T}(stop))
OneTo(r::AbstractRange{T}) where {T<:Integer} = OneTo{T}(r)
## Step ranges parameterized by length
Run Julia and do:
julia> using Revise
julia> Revise.track(Base)
julia> mat = zeros(10,10);
error in running finalizer: MethodError(f=Base.OneTo{T} where T<:Integer, args=(16,), world=0x000000000000722e)
error in running finalizer: MethodError(f=Base.OneTo{T} where T<:Integer, args=(16,), world=0x000000000000722e)
error in running finalizer: MethodError(f=Base.OneTo{T} where T<:Integer, args=(16,), world=0x000000000000722e)
error in running finalizer: MethodError(f=Base.OneTo{T} where T<:Integer, args=(16,), world=0x000000000000722e)
error in running finalizer: MethodError(f=Base.OneTo{T} where T<:Integer, args=(16,), world=0x000000000000722e)
┌ Error: Failed to revise /home/simeon/Documents/Julia/julia/base/range.jl
│ exception =
│ LoadError: MethodError: no method matching Base.OneTo(::Int64)
│ Closest candidates are:
│ Base.OneTo(::AbstractRange{T}) where T<:Integer at range.jl:331
│ Stacktrace:
│ [1] map(f::Type{Base.OneTo}, t::Tuple{Int64})
│ @ Base ./tuple.jl:179
│ [2] axes
│ @ ./abstractarray.jl:75 [inlined]
│ [3] _array_for(#unused#::Type{Symbol}, itr::UnitRange{Int64}, #unused#::Base.HasShape{1})
│ @ Base ./array.jl:678
│ [4] vect(::Symbol, ::Vararg{Symbol, N} where N)
│ @ Base ./array.jl:130
│ [5] docm(source::LineNumberNode, mod::Module, meta::Any, ex::Any, define::Bool)
│ @ Base.Docs ./docs/Docs.jl:545
│ [6] @doc(__source__::LineNumberNode, __module__::Module, x::Vararg{Any, N} where N)
│ @ Core ./boot.jl:508
│ [7] lower
│ @ ./meta.jl:124 [inlined]
│ [8] methods_by_execution!(recurse::Any, methodinfo::Revise.CodeTrackingMethodInfo, docexprs::Dict{Module, Vector{Expr}}, mod::Module, ex::Expr; mode::Symbol, disablebp::Bool, always_rethrow::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│ @ Revise ~/.julia/packages/Revise/fUuEE/src/lowered.jl:178
│ in expression starting at /home/simeon/Documents/Julia/julia/base/range.jl:312
└ @ Revise ~/.julia/packages/Revise/fUuEE/src/Revise.jl:705
┌ Warning: The running code does not match the saved version for the following files:
│
│ /home/simeon/Documents/Julia/julia/base/range.jl
│
│ If the error was due to evaluation order, it can sometimes be resolved by calling `Revise.retry()`.
│ Use Revise.errors() to report errors again. Only the first error in each file is shown.
│ Your prompt color may be yellow until the errors are resolved.
└ @ Revise ~/.julia/packages/Revise/fUuEE/src/Revise.jl:799
SYSTEM (REPL): showing an error caused an error
SYSTEM (REPL): caught exception of type MethodError while trying to handle a nested exception; giving up
julia>
###
### I press `a`
###
fatal: error thrown and no exception handler available.
MethodError(f=Base.OneTo{T} where T<:Integer, args=(32,), world=0x000000000000722e)
jl_method_error_bare at /home/simeon/Documents/Julia/julia/src/gf.c:1767
jl_method_error at /home/simeon/Documents/Julia/julia/src/gf.c:1785
jl_lookup_generic_ at /home/simeon/Documents/Julia/julia/src/gf.c:2355 [inlined]
jl_apply_generic at /home/simeon/Documents/Julia/julia/src/gf.c:2370
map at ./tuple.jl:179
axes at ./abstractarray.jl:75 [inlined]
has_offset_axes at ./abstractarray.jl:85
require_one_based_indexing at ./abstractarray.jl:89
GenericIOBuffer at ./iobuffer.jl:19
GenericIOBuffer at ./iobuffer.jl:27
#IOBuffer#348 at ./iobuffer.jl:98
Type##kw at ./iobuffer.jl:91
#IOBuffer#349 at ./iobuffer.jl:114
GenericIOBuffer at ./iobuffer.jl:112
#with_output_color#795 at ./util.jl:71
with_output_color##kw at ./util.jl:71
unknown function (ip: 0x7fb64c1734c4)
#printstyled#796 at ./util.jl:105
printstyled##kw at ./util.jl:105
unknown function (ip: 0x7fb64c1733eb)
display_error at ./client.jl:102
display_error at ./client.jl:107
jl_apply at /home/simeon/Documents/Julia/julia/src/julia.h:1687 [inlined]
do_apply at /home/simeon/Documents/Julia/julia/src/builtins.c:672
jl_f__apply_latest at /home/simeon/Documents/Julia/julia/src/builtins.c:722
#invokelatest#2 at ./essentials.jl:709 [inlined]
invokelatest at ./essentials.jl:708 [inlined]
_start at ./client.jl:487
jfptr__start_31012 at /home/simeon/Documents/Julia/julia/usr/lib/julia/sys.so (unknown line)
jl_apply at /home/simeon/Documents/Julia/julia/src/julia.h:1687 [inlined]
true_main at /home/simeon/Documents/Julia/julia/src/jlapi.c:553
repl_entrypoint at /home/simeon/Documents/Julia/julia/src/jlapi.c:672
main at /home/simeon/Documents/Julia/julia/cli/loader_exe.c:46
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
_start at ./julia (unknown line)
atexit hook threw an error: MethodError(f=Base.OneTo{T} where T<:Integer, args=(1,), world=0x000000000000722e)%
That should work, right? My best guess is that the compiler is trying to inline a method that Revise just deleted.