config icon indicating copy to clipboard operation
config copied to clipboard

`+=` operator duplicates elements

Open conderls opened this issue 4 years ago • 0 comments

As mentioned in HOCON#field-separator,

A field with += transforms into a self-referential array concatenation. allows a += b to be the first mention of a in the file (it is not necessary to have a = [] first)

I have a reference.conf:

foo {
  bar += "test" # will lead to duplicated `test`

  baz = []
  baz += "test"
}

the foo section is parsed into:

Config(SimpleConfigObject({"bar":["test","test"],"baz":["test"]}))

which should be exactly ["test"] for both bar and baz field.

typesafe version: 1.3.4 with scala: 2.11

conderls avatar Jan 06 '22 02:01 conderls