pyhocon
pyhocon copied to clipboard
Unresolved optional substitutions are lost during merge
Corner case extracted from java issue #332(https://github.com/lightbend/config/issues/332);
- Top config
{foo:42, foo: ${?a}}
. Create an unresolved ConfigTree:unresolved
- Base config
source: {b: 14}
- which doesn't actually providea
-
unresolved.with_fallback(source)
Expected value: {foo:42, b:14}
Instead we get {b: 14}
. When doing merge_configs()
we have overwritten the overriden_value
(42) of foo so we lose the ability to resolve it so it is left out of the final ConfigTree
+1 pyhocon handling of sub vars no longer work.
+1, here a simple case to reproduce
import pyhocon
parser = pyhocon.ConfigFactory()
conf2 = """
x: {
a: ${?test}
}
x: {
a: 3
a: ${?test}
}
"""
result = parser.parse_string(conf2)
assert result.get("x").get("a") == 3
Currently the assertion failed and the actual value is None instead of 3 if test was not defined