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

Keyword arguments parametric types break matching #30792

Closed
lostella opened this issue Jan 22, 2019 · 0 comments
Closed

Keyword arguments parametric types break matching #30792

lostella opened this issue Jan 22, 2019 · 0 comments
Assignees
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) keyword arguments f(x; keyword=arguments) kind:bug Indicates an unexpected problem or unintended behavior

Comments

@lostella
Copy link
Sponsor Contributor

lostella commented Jan 22, 2019

This works on Julia 1.0.3

julia> f(a::C) where {R <: Real, C <: Union{R, Complex{R}}} = println(R)
f (generic function with 1 method)

julia> f(Float64(3))
Float64

julia> f(Float32(3)+Float32(2)im)
Float32

but the following does not

julia> g(a::C; b=R(1)) where {R <: Real, C <: Union{R, Complex{R}}} = println(R)
ERROR: UndefVarError: R not defined
Stacktrace:
 [1] top-level scope at none:0

Discussion here: https://discourse.julialang.org/t/type-matching-with-positional-vs-keyword-arguments/19854

@JeffBezanson JeffBezanson self-assigned this Jan 22, 2019
@JeffBezanson JeffBezanson added compiler:lowering Syntax lowering (compiler front end, 2nd stage) kind:bug Indicates an unexpected problem or unintended behavior keyword arguments f(x; keyword=arguments) labels Jan 22, 2019
KristofferC pushed a commit that referenced this issue Feb 4, 2019
@KristofferC KristofferC mentioned this issue Feb 4, 2019
39 tasks
@KristofferC KristofferC mentioned this issue Feb 11, 2019
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) keyword arguments f(x; keyword=arguments) kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants