Skip to content

Commit

Permalink
skip parameterized functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed May 28, 2024
1 parent 924b768 commit b704f35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/DispatchDoctor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ function _stabilize_fnc(
fex::Expr; warnonly::Bool=false, source_info::Union{LineNumberNode,Nothing}=nothing
)
func = splitdef(fex)
if haskey(func, :params) && length(func[:params]) > 0
# Incompatible with parameterized functions
return fex
end

func_with_body = splitdef(deepcopy(fex))
source_info =
source_info === nothing ? nothing : string(source_info.file, ":", source_info.line)
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ end
)
end
end
@testitem "skip parameterized functions" begin
using DispatchDoctor
struct MyType{T} end
@stable function MyType{T}() where {T}
return T
end
@test MyType{Int}() == Int
end
@testitem "modules" begin
using DispatchDoctor
@stable module Amodules
Expand Down

0 comments on commit b704f35

Please sign in to comment.