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
struct A
x::Intendstruct S
a::Aendfunctionf()
s =S(A(1))
(; a) = s
println(a.x) # !! Missing reference: xprintln(a.a) # !! This is marked ok, but will fail at runtimereturnnothingend
Julia allows tuple destructing structs into a named tuple whose fields get assigned to the fields of the struct. However, the Julia extension’s type inference incorrectly infers the type of the resulting variables. In the above example, (; a) = s leads to the extension assuming a has type S, not A. This leads it to think that a doesn't have a field x when it does, and that a does have a field a when it doesn't. Type inference should be updated to correctly unpack the fields of the struct into the named tuple.
The text was updated successfully, but these errors were encountered:
Sample code:
Julia allows tuple destructing structs into a named tuple whose fields get assigned to the fields of the struct. However, the Julia extension’s type inference incorrectly infers the type of the resulting variables. In the above example,
(; a) = s
leads to the extension assuminga
has typeS
, notA
. This leads it to think thata
doesn't have a fieldx
when it does, and thata
does have a fielda
when it doesn't. Type inference should be updated to correctly unpack the fields of the struct into the named tuple.The text was updated successfully, but these errors were encountered: