Skip to content

Substitution fails for nested sections #321

@M0dEx

Description

@M0dEx

Description

Hi!

We have come across an issue where pyhocon is unable to resolve a nested substitution that should be resolvable, according to the HOCON specification.

Example

base.conf:

foo {
  foo-inner {
    pre-foo = 1
    foo-sub = ${foo.foo-inner.pre-foo}${foo.foo-inner.bar}
  }
}

bar {
  bar-inner {
    foo-sub = ${foo.foo-inner.foo-sub}
  }
}

child.conf:

include required("base.conf")

foo {
  foo-inner {
    bar = 1
  }
}

Expected result

foo {
  foo-inner {
    pre-foo = 1
    foo-sub = 11
    bar = 1
  }
}

bar {
  bar-inner {
    foo-sub = 11
  }
}

Actual result

pyhocon.exceptions.ConfigSubstitutionException: Cannot resolve ${foo.foo-inner.foo-sub}: (line: 10, col: 15). Check for cycles.

If the variables are moved from (foo/bar)-inner to (foo/bar), the substitution works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions