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

Incompatibility with const fields in mutable struct #16

Closed
Tortar opened this issue Oct 10, 2023 · 0 comments · Fixed by #17
Closed

Incompatibility with const fields in mutable struct #16

Tortar opened this issue Oct 10, 2023 · 0 comments · Fixed by #17

Comments

@Tortar
Copy link
Contributor

Tortar commented Oct 10, 2023

Currently

@proto mutable struct B
          const x::Int
       end

throws

ERROR: LoadError: BoundsError: attempt to access 1-element Vector{Any} at index [2]
Stacktrace:
 [1] getindex
   @ ./essentials.jl:13 [inlined]
 [2] #5
   @ ~/.julia/packages/ProtoStructs/4sIVY/src/ProtoStruct.jl:47 [inlined]
 [3] iterate
   @ ./generator.jl:47 [inlined]
 [4] _collect(c::Vector{Expr}, itr::Base.Generator{Vector{Expr}, ProtoStructs.var"#5#12"}, #unused#::Base.EltypeUnknown,
 isz::Base.HasShape{1})
   @ Base ./array.jl:802
 [5] collect_similar(cont::Vector{Expr}, itr::Base.Generator{Vector{Expr}, ProtoStructs.var"#5#12"})
   @ Base ./array.jl:711
 [6] map(f::Function, A::Vector{Expr})
   @ Base ./abstractarray.jl:3263
 [7] var"@proto"(__source__::LineNumberNode, __module__::Module, expr::Any)
   @ ProtoStructs ~/.julia/packages/ProtoStructs/4sIVY/src/ProtoStruct.jl:41
in expression starting at REPL[62]:1

Reiterate the same thing I said in #15 :D

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