We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dce0526 commit 46509e8Copy full SHA for 46509e8
test/runtests.jl
@@ -209,3 +209,28 @@ end
209
210
@test h(1, c=2) == 2
211
end
212
+
213
+struct Baz{T}
214
+ w::T
215
+end
216
217
+@testset "kwdispatch extra arg" begin
218
+ global Baz
219
220
+ @kwdispatch (::Type{B})() where {B<:Baz} begin
221
+ () -> B(0)
222
+ (w) -> B(w)
223
+ (z) -> B(sqrt(z))
224
+ end
225
226
+ @test Baz() == Baz{Int}(0)
227
+ @test Baz{Float64}() == Baz{Float64}(0.0)
228
229
+ @test Baz(w=3) == Baz{Int}(3)
230
+ @test Baz(w=3.0) == Baz{Float64}(3.0)
231
+ @test Baz{Float64}(w=3) == Baz{Float64}(3.0)
232
233
+ @test Baz(z=4) == Baz{Float64}(2.0)
234
+ @test Baz{Int}(z=4) == Baz{Int}(2)
235
+ @test Baz{Float64}(z=4) == Baz{Float64}(2.0)
236
0 commit comments