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
A value that begins with a digit but is no number is text again, as the spec has it: host = 127.0.0.1, 1.2.3, a UUID and 01 are the strings they were written as, no longer a BadNumber error, so an IP address needs no quotes. The number JSON reads at the start is followed by text, as 10.0bar is; the spec's own 1.2.3, a path in a key, is written the same way in a value. So is a value that begins with - and no number: -foo, -Xmx2g, --verbose, and the - in Monty Python - Holy Grail, no longer a HyphenIsNotAJsonNumber error. So are -.5 and -.33e1, which JSON has no number for, as .5 already was. A + outside a number, 1+2 or -.33e+1, stays an error. Seven new conformance cases, eight rows rewritten, all 476 pass.
Added
Twelve conformance cases from bug reports in lightbend/config and ekrich/sconfig where the spec has the answer: typesafe/config fails inside ${a} { … }, turns integers past 2^63 into strings and accepts \u+041; pyhocon loses += across an include and the text of a substituted number. zig-hocon passes all 469.
Eight conformance cases found by fuzzing zig-hocon against typesafe/config, where the spec has the answer: typesafe/config rejects a { m = 2 } { n = 1 } and 3+=[], loses the first += after c = null and keeps the number in [${?x}10]. zig-hocon passes all 490.
The conformance suite has 552 cases: 22 more from fuzzing that zig-hocon already passed, and its harness no longer takes true for 1 or splits an answer at U+0085. docs/resolver.md draws how substitutions resolve.
Fixed
An object after a substitution, top = ${x} { … }, is a merge, the same as top = ${x} and top { … } written as two fields. A += inside it appends to the list ${x} gives (top = ${x} { arr += four } was [four], is [one, four]), a self-reference looks back at it, and ${top.n} inside it sees the merged object instead of reporting a cycle. Eight new conformance cases pin it.
Layers of a key are merged before they are resolved, as the spec has it: in p : { a : ${y} }, p : ${x} with x.a set, ${y} is hidden and no longer evaluated (it was an error), and a reference in the earlier object sees the final value. Three more conformance cases, all 457 pass.
A field that refers to itself with nothing before it reads the environment variable of its own name, as the spec has it: HOME : ${HOME} is the variable HOME, where it was Unresolved, and HOME : ${?HOME} creates the field instead of dropping it, as pyhocon does. A value set earlier still wins, and HOME += x with HOME set is now an error: += is HOME = ${?HOME} [x], text and a list. Two new conformance cases, all 478 pass.
A NUL byte inside a file is a character, as the spec has it, no longer the end of the file. In a comment it dropped everything below without a word: a = 1 # note<NUL>, then b = 2, read as {a: 1}, and a file saved as UTF-16 without a byte order mark read as {}, where it is now an error. In unquoted and triple-quoted text the NUL is kept (a = x<NUL>y was an error); in a quoted string it is an error, as any control character is. Four new conformance cases, all 482 pass.
A comma after a braced root, { a = 1 }, or [1, 2],, is an error now, as the spec and typesafe/config have it; it was accepted. Two new conformance cases, all 492 pass.
a = null then a { … } clears what a held before also when the file is included or the object merges with an earlier one: a { x = 1 } and then include "over.conf" with those two lines give {a: {…}} without x, as typesafe/config has it; the x was kept. Four new conformance cases, all 496 pass.
An optional substitution on a cycle finds nothing also when the cycle runs on through other fields: v { x = ${?r} } with r = ${v} gives v = {} and r = {}, as typesafe/config has it; it was a SubstitutionCycle.
A substitution path through an alias resolves only what it reaches: a = ${p} with p = { r = ${a.q} } reads p.q, as typesafe/config does; it was a SubstitutionCycle.
a = ${p}, p = 1, p = ${a}x resolves to a = 1, p = "1x" in any order of the lines, as typesafe/config has it: the cycle breaks where p can look back. With a first it was a SubstitutionCycle.
A field that looks back and refers to the object it is in sees that object with the field at its earlier value: o { a = [], a += ${o} } is o = {a: [{a: []}]}, as typesafe/config has it; it was a SubstitutionCycle. Four new conformance cases, all 500 pass.
A word that begins with a number holding a + in its exponent and goes on as text is that text, as 10.0bar is: 1e+5.x is "1e+5.x" and 1e+5.5 = 1 is the path 1e+5, 5, where both were a BadNumber error. A + after that number, 1e+5e+5, is still an error. HOCON written out quotes such a word, for typesafe/config and pyhocon, which reject it bare. Six new conformance cases, all 506 pass.
An optional substitution that leads back to the field it stands in is nonexistent, whichever field is resolved first, as the spec has it: f = ${?a.t}x, a = ${?y}${?f} gives f = "x" in either order of the lines, and o = ${a.n} with a { n = { h = 0 } ${?a} } gives o the one value a.n has, where it was {h: 0, n: {h: 0}}. d = yes${?c}, c = ${d} and e += ${?c}, c = ${e} resolve instead of reporting a cycle when d or e comes first. o = ${a.n} with a { n = ${?a} } is now an error: a.n is never created, where o was {}.
Cycles typesafe/config breaks are broken: a path into a field that refers back to itself looks back (d { a = ${i.b} }, i.b = 7, i = ${d}), and so does an alias in a list (a = [${p}], p = 1, p = ${a}) or written twice, and a look-back inside a list element (a = [{ c = 2, c = ${a} }]). What an object or a list resolves to inside such a look-back is its value. A field that refers to the object it is in, v { x = ${v} }, stays an error, as the spec names it unbreakable.
A concatenation with a list in it under an object is hidden and never evaluated, as the spec has it: c = [1] ${x}, c = { a = 1 } is {a: 1}, where it was an error. Seventeen new conformance cases, all 523 pass.
+= and an include inside an object in a list work from that object, as the spec has it: a = [{ b = [1], b += 2 }] is [{b: [1, 2]}], where the earlier b was not seen and it was [{b: [2]}], and += onto a value there that is no list is an error, as anywhere. A file included into a list element looks its substitutions up in that element first, then at the document root (a = [{ include "child.conf" }], child x = ${y}, y = 1, was an error or took a root y). Five new conformance cases, all 528 pass.
include url("file:///…/inc") loads exactly that file, as the spec has it for every URL: with only inc.conf beside it, it found inc.conf, as a basename does. The conformance suite can now name an absolute file: URL in a case (@CASE_DIR@), and has its first two. All 530 pass.