-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)
Description
Consider:
julia> struct Foo
x
f
end
julia> f = Foo(1, 2)
Foo(1, 2)
we have:
julia> (; x, f) = f
2
but
julia> (; f, x) = f
ERROR: type Int64 has no field x
Stacktrace:
[1] getproperty(x::Int64, f::Symbol)
@ Base ./Base.jl:38
[2] top-level scope
@ REPL[6]:1
Also in the first case, the overall return is the new value of f
, but I believe it would be more consistent to return the old value of f. I think the syntax should work in phases, where it collects all the values into ssa values and only then applies the updates.
Seelengrab, martinholters, simeonschaub, pdeffebach and c42f
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)