From 2ff6c69ebcd79d04b3ef5dcc8ea69467db1da784 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 22 Jan 2022 08:35:26 -0600 Subject: [PATCH] Skip tests obsoleted by inference improvements (#274) --- test/snoopi.jl | 9 ++++++++- test/snoopi_deep.jl | 27 +++++++++++++++++++-------- test/snoopr.jl | 4 +++- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/test/snoopi.jl b/test/snoopi.jl index 0382ba3f..802061ca 100644 --- a/test/snoopi.jl +++ b/test/snoopi.jl @@ -132,7 +132,14 @@ uncompiled(x) = x + 1 @test any(str->occursin("kwftype", str), FK) @test !any(str->occursin(r"Type\{NamedTuple.*typeof\(sin\)", str), FK) if VERSION >= v"1.4.0-DEV.215" - @test any(str->occursin("__lookup_kwbody__", str), FK) + mis = last.(tinf) + if !isempty(filter(mis) do mi + length(mi.specTypes.parameters) >= 2 && mi.specTypes.parameters[end-1] === typeof(sortperm) && !(mi.specTypes.parameters[2] <: NamedTuple) + end) + @test any(str->occursin("__lookup_kwbody__", str), FK) + else + @warn "Body method was not toplevel-inferred, test skipped" + end else @test any(str->occursin("isdefined", str), FK) end diff --git a/test/snoopi_deep.jl b/test/snoopi_deep.jl index 39c618ff..c28bdea0 100644 --- a/test/snoopi_deep.jl +++ b/test/snoopi_deep.jl @@ -365,10 +365,16 @@ end @noinline callf(@nospecialize(f::Function), x) = f(x) g(x) = callf(sqrt, x) end - cats = categories(@snoopi_deep M.g(3)) - @test cats == [SnoopCompile.FromTestCallee, SnoopCompile.CallerInlineable, SnoopCompile.Invoke] - SnoopCompile.show_suggest(io, cats, nothing, nothing) - @test occursin(r"invoked callee.*may fail to precompile", String(take!(io))) + tinf = @snoopi_deep M.g(3) + itrigs = inference_triggers(tinf) + if !isempty(itrigs) + cats = categories(tinf) + @test cats == [SnoopCompile.FromTestCallee, SnoopCompile.CallerInlineable, SnoopCompile.Invoke] + SnoopCompile.show_suggest(io, cats, nothing, nothing) + @test occursin(r"invoked callee.*may fail to precompile", String(take!(io))) + else + @warn "Skipped Invoke test due to improvements in inference" + end # FromInvokeLatest M = Module() @@ -477,10 +483,15 @@ end Base.show(io::IO, ::BType) = print(io, "B") @noinline doprint(ref) = print(IOBuffer(), "a", ref[], 3.2) end - cats = categories(@snoopi_deep M.doprint(Ref{Union{M.AType,M.BType}}(M.AType()))) - @test cats == [SnoopCompile.FromTestCallee, SnoopCompile.InvokedCalleeVararg] - SnoopCompile.show_suggest(io, cats, nothing, nothing) - @test occursin(r"invoked callee is varargs.*homogenize", String(take!(io))) + tinf = @snoopi_deep M.doprint(Ref{Union{M.AType,M.BType}}(M.AType())) + if !isempty(inference_triggers(tinf)) + cats = categories(tinf) + @test cats == [SnoopCompile.FromTestCallee, SnoopCompile.InvokedCalleeVararg] + SnoopCompile.show_suggest(io, cats, nothing, nothing) + @test occursin(r"invoked callee is varargs.*homogenize", String(take!(io))) + else + @warn "Skipped InvokeCalleeVararg test due to improvements in inference" + end # Vararg that resolves to a UnionAll M = Module() diff --git a/test/snoopr.jl b/test/snoopr.jl index e7ea08f5..1a798121 100644 --- a/test/snoopr.jl +++ b/test/snoopr.jl @@ -214,7 +214,9 @@ end invs = @snoopr (::Type{T})(x::SnooprTests.MyInt) where T<:Integer = T(x.x) umis1 = uinvalidated(invs) umis2 = uinvalidated(invs; exclude_corecompiler=false) - @test length(umis2) > length(umis1) + 20 + if Base.VERSION < v"1.8.0-DEV" + @test length(umis2) > length(umis1) + 20 + end # recursive filtermod list = Union{Int,String}[1,2]