Skip to content

Commit e4812a3

Browse files
authored
Merge pull request #542 from raphaelchinchilla/return_tuples
Included dispatch to toexpr that creates Tuples correctly
2 parents 91879dd + 564ba54 commit e4812a3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/code.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ function toexpr(O, st)
188188
end
189189
end
190190

191+
function toexpr(O::Tuple, st)
192+
:(($(toexpr.(O, (st,))...),))
193+
end
194+
191195
# Call elements of vector arguments by their name.
192196
@matchable struct DestructuredArgs
193197
elems

test/code.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ nanmath_st.rewrites[:nanmath] = true
183183
:(SparseVector(10, $(spvec.nzind), [a])))
184184
test_repr(toexpr(MakeTuple((a, b, a+b))),
185185
:((a,b,$(+)(a,b))))
186+
test_repr(toexpr((a, b, a+b)),
187+
:((a,b,$(+)(a,b))))
186188

187189
@test SpawnFetch{Multithreaded}([()->1,()->2],vcat)|>toexpr|>eval == [1,2]
188190
@test @elapsed(SpawnFetch{Multithreaded}([:(()->sleep(2)),

0 commit comments

Comments
 (0)