@@ -59,7 +59,8 @@ struct TestCallableStruct end
59
59
end
60
60
61
61
@testset " varadic Tuple" begin
62
- @test_signature vt1 (:: Tuple{Vararg{Int64, N}} ) where N = 2
62
+ @test_signature vt1 (:: Tuple{Vararg{Int64,N}} ) where {N} = 2
63
+ VERSION >= v " 1.7" && @test_signature vt2 (:: Tuple{Vararg{Int64}} ) = 2
63
64
end
64
65
65
66
@testset " Scope Qualification" begin
@@ -131,21 +132,31 @@ struct TestCallableStruct end
131
132
end
132
133
133
134
@testset " vararg" begin
134
- @test_signature f17 (xs:: Vararg{Any, N} where N) = 2
135
+ if VERSION >= v " 1.7"
136
+ @test_signature f17 (xs:: Vararg{Any} ) = 2
137
+ # `f17_alt(xs...) = 2` lowers to the same method as `f17`
138
+ # but has a different AST according to `splitdef` so we can't us @test_signature
139
+ f17_alt (xs... ) = 2
140
+ test_matches (
141
+ signature (only_method (f17_alt)),
142
+ Dict (:name => :f17_alt , :args => [:(xs:: Vararg{Any} )]),
143
+ )
135
144
136
- # `f17_alt(xs...) = 2` lowers to the same method as `f18`
137
- # but has a different AST according to `splitdef` so we can't us @test_signature
138
- f17_alt (xs... ) = 2
139
- test_matches (
140
- signature (only_method (f17_alt)),
141
- Dict (
142
- :name => :f17_alt ,
143
- :args => [:(xs:: (Vararg{Any, N} where N) )]
145
+ @test_signature f18 (xs:: Vararg{Int64} ) = 2
146
+ @test_signature f19 (x, xs:: Vararg{Any} ) = 2 x
147
+ else
148
+ @test_signature f17b (xs:: Vararg{Any,N} where {N}) = 2
149
+ # `f17b_alt(xs...) = 2` lowers to the same method as `f17b`
150
+ # but has a different AST according to `splitdef` so we can't us @test_signature
151
+ f17b_alt (xs... ) = 2
152
+ test_matches (
153
+ signature (only_method (f17b_alt)),
154
+ Dict (:name => :f17b_alt , :args => [:(xs:: (Vararg{Any,N} where {N}) )]),
144
155
)
145
- )
146
156
147
- @test_signature f18 (xs:: Vararg{Int64, N} where N) = 2
148
- @test_signature f19 (x, xs:: Vararg{Any, N} where N) = 2 x
157
+ @test_signature f18b (xs:: Vararg{Int64,N} where {N}) = 2
158
+ @test_signature f19b (x, xs:: Vararg{Any,N} where {N}) = 2 x
159
+ end
149
160
end
150
161
151
162
@testset " kwargs" begin
@@ -312,7 +323,17 @@ struct TestCallableStruct end
312
323
@test length (no_hygiene[:whereparams ]) == 1
313
324
@test no_hygiene[:whereparams ] != hygiene[:whereparams ] # different Symbols
314
325
# very coarse test to make sure the renamed arg is in the expression it should be
315
- @test occursin (string (no_hygiene[:whereparams ][1 ]), string (no_hygiene[:args ][1 ]))
326
+ @test occursin (
327
+ string (no_hygiene[:whereparams ][1 ]), string (no_hygiene[:args ][1 ])
328
+ )
329
+ end
330
+ end
331
+
332
+ @testset " internals" begin
333
+ @testset " name_of_type" begin
334
+ # This isn't part of the public API, and isn't currently hit by anything that is
335
+ # but it really seems like it should work.
336
+ VERSION >= v " 1.7" && @test ExprTools. name_of_type (Vararg) == :(Vararg{Any})
316
337
end
317
338
end
318
339
end
0 commit comments