Skip to content

Commit 61858b0

Browse files
committed
Vendor the tested "NamedTuple" constructor
1 parent 5da14d5 commit 61858b0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
266266
@test line == m.line
267267

268268
# Issue 115, Cthulhu issue 474
269-
m = @which NamedTuple{(),Tuple{}}(())
269+
m = @which MyNamedTuple{(),Tuple{}}(())
270270
src, line = definition(String, m)
271-
@test occursin("NamedTuple{names, T}(args::T) where {names, T <: Tuple}", src)
271+
@test occursin("MyNamedTuple{names, T}(args::T) where {names, T <: Tuple}", src)
272272
@test line == m.line
273273

274274
# Parsed result gives a symbol instead of expression

test/script.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,9 @@ end
160160
function (::Type{MyArray2{T,1}})(::UndefInitializer, m::Int) where {T}
161161
return nothing
162162
end
163+
164+
# Issue #115
165+
struct MyNamedTuple{names, T} end
166+
@eval (MyNamedTuple{names, T}(args::T) where {names, T <: Tuple}) = begin
167+
$(Expr(:splatnew, :(MyNamedTuple{names, T}), :args))
168+
end

0 commit comments

Comments
 (0)