Skip to content

Commit 3d1d6e6

Browse files
authored
Fix array of tuple any (#1685)
* Fix array of tuple any * Update typetree.jl * Update typetree.jl
1 parent ad1f2d8 commit 3d1d6e6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/typetree.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ end
161161
offset = 0
162162

163163
tt = copy(typetree(T, ctx, dl, seen))
164-
if !allocatedinline(T)
164+
if !allocatedinline(T) && Base.isconcretetype(T)
165165
merge!(tt, TypeTree(API.DT_Pointer, ctx))
166166
only!(tt, 0)
167167
end
@@ -184,7 +184,7 @@ else
184184
function typetree_inner(::Type{<:GenericMemory{kind, T}}, ctx, dl, seen::TypeTreeTable) where {kind, T}
185185
offset = 0
186186
tt = copy(typetree(T, ctx, dl, seen))
187-
if !allocatedinline(T)
187+
if !allocatedinline(T) && Base.isconcretetype(T)
188188
merge!(tt, TypeTree(API.DT_Pointer, ctx))
189189
only!(tt, 0)
190190
end

test/runtests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,6 +3236,23 @@ end
32363236
@test ad_eta[1] 0.0
32373237
end
32383238

3239+
function absset(out, x)
3240+
@inbounds out[1] = (x,)
3241+
return nothing
3242+
end
3243+
3244+
@testset "Abstract Array element type" begin
3245+
out = Tuple{Any}[(9.7,)]
3246+
dout = Tuple{Any}[(4.3,)]
3247+
3248+
autodiff(Enzyme.Forward,
3249+
absset,
3250+
Duplicated(out, dout),
3251+
Duplicated(3.1, 2.4)
3252+
)
3253+
@test dout[1][1] 2.4
3254+
end
3255+
32393256
@testset "Tape Width" begin
32403257
struct Roo
32413258
x::Float64

0 commit comments

Comments
 (0)