You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I may have stumbled upon a bug with getproperty on accessing container types, although I suspect it's actually a missing convert in the constructor's definition. For example
using Moshi.Data:@data@data OptionVec{T} begin
None
struct Some
n::T
xs::Vector{Any}endend
A = OptionVec.Some{String}("hi", [1, 2])
A.xs
gives the error
ERROR: TypeError: in typeassert, expected Vector{Any}, got a value of type Vector{Int64}
Stacktrace:
[1] getproperty(value::Main.OptionVec.var"typeof(OptionVec)"{String}, name::Symbol)
@ Main.OptionVec ~/.julia/packages/Moshi/SEGHC/src/data/emit/getproperty.jl:21
[2] top-level scope
@ REPL[5]:1
This can obviously be fixed by just converting before the constructor OptionVec.Some{String}("hi", Any[1, 2]) but I would expect the constructor to automatically handle the conversion to the specified variant's type?
The text was updated successfully, but these errors were encountered:
I think I may have stumbled upon a bug with
getproperty
on accessing container types, although I suspect it's actually a missingconvert
in the constructor's definition. For examplegives the error
This can obviously be fixed by just converting before the constructor
OptionVec.Some{String}("hi", Any[1, 2])
but I would expect the constructor to automatically handle the conversion to the specified variant's type?The text was updated successfully, but these errors were encountered: