Skip to content

Commit

Permalink
Remove vararg tuple warning (EnzymeAD#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Apr 20, 2024
1 parent 43340b3 commit 4230cc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ end
end
end

@inline is_concrete_tuple(x::T2) where T2 = (x <: Tuple) && !(x === Tuple) && !(x isa UnionAll)

@assert !Base.isabstracttype(T)
if !(Base.isconcretetype(T) || is_concrete_tuple(T) || T isa UnionAll)
throw(AssertionError("Type $T is not concrete type or concrete tuple"))
Expand Down
6 changes: 6 additions & 0 deletions src/typetree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ function typetree_inner(@nospecialize(T), ctx, dl, seen::TypeTreeTable)
return TypeTree()
end

@static if VERSION >= v"1.7.0"
if is_concrete_tuple(T) && any(T2 isa Core.TypeofVararg for T2 in T.parameters)
return TypeTree()
end
end

try
fieldcount(T)
catch
Expand Down
3 changes: 3 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
unsafe_to_pointer(ptr) = ccall(Base.@cfunction(x->x, Ptr{Cvoid}, (Ptr{Cvoid},)), Ptr{Cvoid}, (Any,), ptr)
export unsafe_to_pointer

@inline is_concrete_tuple(x::T2) where T2 = (x <: Tuple) && !(x === Tuple) && !(x isa UnionAll)
export is_concrete_tuple

const Tracked = 10
const Derived = 11
export Tracked, Derived
Expand Down

0 comments on commit 4230cc0

Please sign in to comment.