Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't dispatch on Type{} #10

Open
simonbyrne opened this issue Sep 25, 2020 · 2 comments
Open

Can't dispatch on Type{} #10

simonbyrne opened this issue Sep 25, 2020 · 2 comments

Comments

@simonbyrne
Copy link
Owner

From #9:

julia> using KeywordDispatch

julia> @kwdispatch f()

julia> @kwmethod f(;a::Type{Float64}) = 1

julia> f(a=Float64)
ERROR: KeywordMethodError: no keyword method matching f(; a::DataType)
Stacktrace:
 [1] kwcall(::NamedTuple{(:a,),Tuple{DataType}}, ::Function) at /Users/simon/src/KeywordDispatch.jl/src/KeywordDispatch.jl:102
 [2] f(; kwargs::Base.Iterators.Pairs{Symbol,DataType,Tuple{Symbol},NamedTuple{(:a,),Tuple{DataType}}}) at /Users/simon/src/KeywordDispatch.jl/src/KeywordDispatch.jl:177
 [3] top-level scope at REPL[5]:1
@simonbyrne
Copy link
Owner Author

To clarify, the core reason this doesn't work is that

julia> (Float64,) isa Tuple{Type{Float64}}
false

@simonbyrne
Copy link
Owner Author

Discussed in JuliaLang/julia#10947

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant