NamedTuples.jl icon indicating copy to clipboard operation
NamedTuples.jl copied to clipboard

fix setindex updates to existing elements of NT

Open magerton opened this issue 6 years ago • 1 comments

Fixes setindex so that function can "update" arguments in place and added test. Looks like was an issue with the order of the arguments in merge function. Seems to relate to #40

MWE shows current issue

using NamedTuples
x = @NT(a = 1)
@show setindex(x, :a, 2) # (a=1)
@show merge(@NT(a=2), x) # (a=2) CORRECT!
@show merge(x, @NT(a=2)) # (a=1)

magerton avatar Jun 04 '18 21:06 magerton

Codecov Report

Merging #71 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #71   +/-   ##
=======================================
  Coverage   73.18%   73.18%           
=======================================
  Files           1        1           
  Lines         179      179           
=======================================
  Hits          131      131           
  Misses         48       48
Impacted Files Coverage Δ
src/NamedTuples.jl 73.18% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6353fcc...8621fca. Read the comment docs.

codecov-io avatar Jun 04 '18 22:06 codecov-io