Skip to content

Commit

Permalink
Add comment explaining why calling outer constructor in setproperties
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenszhu committed Nov 5, 2024
1 parent 84a0596 commit 187ce45
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const SIMPLIFIED = 0x01 << 0
function ConstructionBase.setproperties(obj::BasicSymbolic{T}, patch::NamedTuple)::BasicSymbolic{T} where T
nt = getproperties(obj)
nt_new = merge(nt, patch)
# Call outer constructor because hash consing cannot be applied in inner constructor
@compactified obj::BasicSymbolic begin
Sym => Sym{T}(nt_new.name; nt_new...)
_ => Unityper.rt_constructor(obj){T}(;nt_new...)
Expand Down

0 comments on commit 187ce45

Please sign in to comment.