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

Unexpected cyclic substitution loop error #128

Closed
nareshj09 opened this issue Nov 14, 2019 · 1 comment · Fixed by #141
Closed

Unexpected cyclic substitution loop error #128

nareshj09 opened this issue Nov 14, 2019 · 1 comment · Fixed by #141
Milestone

Comments

@nareshj09
Copy link

Parsing following valid config

c: {
    q: {
        a: [2, 5]
    }
}
c: {
    m: ${c.q} {p: 75}
    m.a: ${c.q.a} [6]
}

results in exception

Unhandled exception. Hocon.HoconParserException: Invalid substitution declaration. A cyclic substitution loop is detected in the Hocon file.. At path 'c.q.a', line 8, position 14.
 ---> Hocon.HoconException: A cyclic substitution loop is detected in the Hocon file.
   at Hocon.Parser.ResolveSubstitution(HoconSubstitution sub)
   at Hocon.Parser.ResolveSubstitutions()
   --- End of inner exception stack trace ---
   at Hocon.Parser.ResolveSubstitutions()
   at Hocon.Parser.ParseText(String text, Boolean resolveSubstitutions, HoconIncludeCallbackAsync includeCallback)
   at Hocon.Parser.Parse(String text, HoconIncludeCallbackAsync includeCallback)

EXPECTED:

c: {
    q: {
        a: [2, 5]
    }
}
c: {
    m: { a: [2, 5, 6], p: 75 }
}
@IgorFedchenko
Copy link
Contributor

@Aaronontheweb I have added test to verify this works.
On the dev branch before I have fixed few issues in the milestone, this test was failing (I have just checked that). But after applying latest fixes, this does not reproduce anymore.

I think that this is related to #127 where I have added deep cloning of substituted values - so now when performing substitution it will always be different values in different places, and no cycles are possible.

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

Successfully merging a pull request may close this issue.

3 participants