From a63ffa3dc9f5e9abb9f7e7295767fd3992b46d5c Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 8 Aug 2023 15:12:26 +0100 Subject: [PATCH] Fix issue 115 --- src/utils.jl | 4 ++++ test/runtests.jl | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/utils.jl b/src/utils.jl index 69dd16d..fbba6ca 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -91,6 +91,10 @@ function is_func_expr(@nospecialize(ex), meth::Method) fname = fname.args[end] modified = true end + if isexpr(fname, :where) + fname = fname.args[1] + modified = true + end end if !(isa(fname, Symbol) && is_gensym(fname)) && !isexpr(fname, :$) if fname === :Type && isexpr(ex.args[1], :where) && isexpr(callex.args[1], :(::)) && isexpr(callex.args[1].args[end], :curly) diff --git a/test/runtests.jl b/test/runtests.jl index efc7c3d..84c2f1e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -250,6 +250,12 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j d = IdDict{Union{String,Symbol},Union{Function,Vector{Function}}}() CodeTracking.invoked_setindex!(d, sin, "sin") @test CodeTracking.invoked_get!(Vector{Function}, d, :cos) isa Vector{Function} + + # Issue 115, Cthulhu issue 404 + m = @which (Vector)(Int[]) + src, line = definition(String, m) + @test occursin("(Array{T,N} where T)(x::AbstractArray{S,N}) where {S,N}", src) + @test line == m.line end @testset "With Revise" begin