diff --git a/test/snoop_invalidations.jl b/test/snoop_invalidations.jl index 8efbd629..79558dbb 100644 --- a/test/snoop_invalidations.jl +++ b/test/snoop_invalidations.jl @@ -220,20 +220,6 @@ end @test occursin(r"deleting Float64\(::Irrational{:twoπ}\).*invalidated:\n.*mt_disable: MethodInstance for Float64\(::Irrational{:twoπ}\)", str) @test occursin(r"deleting Float32\(::Irrational{:twoπ}\).*invalidated:\n.*mt_disable: MethodInstance for Float32\(::Irrational{:twoπ}\)", str) @test occursin(r"deleting BigFloat\(::Irrational{:twoπ}; precision\).*invalidated:\n.*backedges: 1: .*with MethodInstance for BigFloat\(::Irrational{:twoπ}\) \(1 children\)", str) - # #268 - invs = @snoop_invalidations begin - @eval Module() begin - @noinline Base.throw_boundserror(A, I) = throw(BoundsError(A, I)) - end - end - trees = invalidation_trees(invs) - show(io, trees) - lines = split(String(take!(io)), '\n') - idx = findfirst(str -> occursin("mt_disable", str), lines) - if idx !== nothing - @test occursin("throw_boundserror", lines[idx]) - @test occursin(r"\+\d+ more", lines[idx+1]) - end # Exclusion of Core.Compiler methods invs = @snoop_invalidations (::Type{T})(x::SnooprTests.MyInt) where T<:Integer = T(x.x) @@ -277,3 +263,20 @@ end Pkg.activate(cproj) end + +# This needs to come after "Delayed invalidations", as redefining `throw_boundserror` invalidates a lot of stuff +@testset "throw_boundserror" begin + # #268 + invs = @snoop_invalidations begin + @eval Module() begin + @noinline Base.throw_boundserror(A, I) = throw(BoundsError(A, I)) + end + end + trees = invalidation_trees(invs) + lines = split(sprint(show, trees), '\n') + idx = findfirst(str -> occursin("mt_disable", str), lines) + if idx !== nothing + @test occursin("throw_boundserror", lines[idx]) + @test occursin(r"\+\d+ more", lines[idx+1]) + end +end