Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved optional substitutions are lost during merge #154

Open
aalba6675 opened this issue May 3, 2018 · 2 comments
Open

Unresolved optional substitutions are lost during merge #154

aalba6675 opened this issue May 3, 2018 · 2 comments

Comments

@aalba6675
Copy link
Contributor

aalba6675 commented May 3, 2018

Corner case extracted from java issue #332(lightbend/config#332);

  1. Top config {foo:42, foo: ${?a}}. Create an unresolved ConfigTree: unresolved
  2. Base config source: {b: 14} - which doesn't actually provide a
  3. 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

@aalba6675 aalba6675 changed the title Unresolved optional substitutions are lost during merged Unresolved optional substitutions are lost during merge May 3, 2018
@ayen-tibco
Copy link

+1 pyhocon handling of sub vars no longer work.

@etiennebrateau
Copy link

etiennebrateau commented Nov 22, 2022

+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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants