-
Notifications
You must be signed in to change notification settings - Fork 12
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
better error description for positional argument #73
Comments
Positional constructor is supported but it should only be your default constructor. You should write MyOption(1, 2) not just MyOption(1) I can see why you think there is a constructor with vararg. But I don't think having that is very useful in more complicated case given there's already a keyword constructor and this is the same behavior of Base.@kedef |
For a normal struct type without such constructor I think you get a similar error isn't it? |
My apologies for not describing it very clearly. I was hoping the error stack become cleaner/shorter, e.g.,: julia> Base.@kwdef struct MyOption
x::Int
y::Int = 1
end
MyOption
julia> MyOption(1)
ERROR: MethodError: no method matching MyOption(::Int64)
Closest candidates are:
MyOption(::Int64, ::Int64) at REPL[1]:2
MyOption(::Any, ::Any) at REPL[1]:2
MyOption(; x, y) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/util.jl:478
Stacktrace:
[1] top-level scope
@ REPL[2]:1 |
Oh I guess this is a julia issue with not so good support for codegen methods? |
just need to insert the line number correctly in this package: https://github.com/Roger-luo/Expronicon.jl |
MyOption(2)
throws some encrypted error messages besides the core errorMethodError: no method matching MyOption(::Int64)
Maybe it's a good idea to eagerly generate dummy and descriptive messages here, e.g., defining
Is it
Configurations.jl/src/codegen.jl
Lines 351 to 353 in 6aad922
The text was updated successfully, but these errors were encountered: