Skip to content

Commit af5bc62

Browse files
committed
Merge remote-tracking branch 'origin/ox/typeotype' into ox/mutation2
2 parents 867acc5 + 2a9a3f7 commit af5bc62

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/stage1/recurse_fwd.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ function (::∂☆new{1})(B::Type, xs::AbstractTangentBundle{1}...)
2323
tangent_nt = NamedTuple{names}(tangent_tup)
2424
StructuralTangent{B}(tangent_nt)
2525
end
26-
@show typeof(the_partial)
27-
#TODO: I think we need https://github.com/JuliaDiff/Diffractor.jl/pull/236/files here
28-
return TaylorBundle{1, B}(the_primal, (the_partial,))
26+
B2 = typeof(the_primal) # HACK: if the_primal actually has types in it then we want to make sure we get DataType not Type(...)
27+
return TaylorBundle{1, B2}(the_primal, (the_partial,))
2928
end
3029

3130
function (::∂☆new{N})(B::Type, xs::AbstractTangentBundle{N}...) where {N}

test/forward.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ end
148148
end
149149

150150

151+
@testset "types in tuples" begin
152+
function foo(a)
153+
tup = (a, 2a, Int)
154+
return tup[2]
155+
end
156+
157+
let var"'" = Diffractor.PrimeDerivativeFwd
158+
@test foo'(100.0) == 2.0
159+
end
160+
end
161+
162+
151163
@testset "taylor_compatible" begin
152164
taylor_compatible = Diffractor.taylor_compatible
153165

0 commit comments

Comments
 (0)