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

Doesn't seem to convert constructor arguments #40

Open
zot opened this issue Jul 16, 2024 · 0 comments · May be fixed by #41
Open

Doesn't seem to convert constructor arguments #40

zot opened this issue Jul 16, 2024 · 0 comments · May be fixed by #41

Comments

@zot
Copy link

zot commented Jul 16, 2024

@kwdef handles conversion but @proto does not seem to.

julia> @kwdef struct Bubba x::Int = 3; y::Float64 = 5; end
Bubba

julia> Bubba()
Bubba(3, 5.0)

julia> @proto @kwdef struct Gump x::Int = 3; y::Float64 = 5; end

julia> Gump()
ERROR: MethodError: no method matching Gump(::Int64, ::Int64)

Closest candidates are:
  Gump(::Int64, ::Float64)
   @ Main ~/.julia/packages/ProtoStructs/6Bp9y/src/ProtoStruct.jl:223

Stacktrace:
 [1] Gump(; x::Int64, y::Int64)
   @ Main ~/.julia/packages/ProtoStructs/6Bp9y/src/ProtoStruct.jl:233
 [2] Gump()
   @ Main ~/.julia/packages/ProtoStructs/6Bp9y/src/ProtoStruct.jl:232
 [3] top-level scope
   @ REPL[5]:1

Just guessing here but is the constructor function generated based on the initializer types instead of the declared types?

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

Successfully merging a pull request may close this issue.

1 participant