From 4839d356747560d86a92b26f330e20b5f1221146 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 2 Feb 2022 05:41:41 -0600 Subject: [PATCH] Improve test coverage As often happens, this discovered a bug on some Julia versions. --- src/MethodAnalysis.jl | 4 ++-- test/runtests.jl | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/MethodAnalysis.jl b/src/MethodAnalysis.jl index 1ad32ae..1ba8517 100644 --- a/src/MethodAnalysis.jl +++ b/src/MethodAnalysis.jl @@ -24,8 +24,8 @@ Split a signature type like `Tuple{typeof(f),ArgTypes...}` back out to `(f, Tupl function call_type(tt) ft = tt.parameters[1] argt = Tuple{tt.parameters[2:end]...} - name = Symbol(String(ft.name.name)[2:end]) # strip off leading '#' - return (getfield(ft.name.module, name), argt) + name = Symbol(String(ft.name.name)) + return (getfield(ft.name.module, name).instance, argt) end """ diff --git a/test/runtests.jl b/test/runtests.jl index 7933a5d..63f4365 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -94,10 +94,11 @@ end @test methodinstance(f, (Real,)) === nothing mi = methodinstance(f, (Float64,)) @test mi.specTypes == Tuple{typeof(f),Float64} - mis = methodinstances(f, (Real,)) - @test length(mis) == 2 - @test all(mis) do mi - mi.specTypes ∈ (Tuple{typeof(f),Float64}, Tuple{typeof(f),Int}) + for mis in (methodinstances(f, (Real,)), methodinstances(Tuple{typeof(f),Real})) + @test length(mis) == 2 + @test all(mis) do mi + mi.specTypes ∈ (Tuple{typeof(f),Float64}, Tuple{typeof(f),Int}) + end end end