-
Notifications
You must be signed in to change notification settings - Fork 57
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
Self-Referential Substitutions don't work #105
Comments
The implementation is incomplete. I would appreciate any help finishing it for those cases. |
Even the simplest testcase does not work:
Maybe this one is easier to fix? |
That is likely HC-73. I'll take a quick look to see if I can figure out what's wrong, but don't have a ton of time to spend on it before I'm on vacation for 2 weeks. |
This library was implemented to closely mirror the structure of https://github.com/lightbend/config. So tracing the exception I get with your simple test case back to https://github.com/puppetlabs/cpp-hocon/blob/master/lib/src/values/config_reference.cc#L75 and comparing to https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/ConfigReference.java#L70, it looks like the fallback code at https://github.com/puppetlabs/cpp-hocon/blob/master/lib/src/values/config_reference.cc#L61 wasn't implemented. I'll try that out. |
It looks like this might have actually been fixed recently in config v1.3.2. So there's some work to incorporate the fixes added. Update: I might be jumping to conclusions here; but this is the area where a fix will probably be needed. If it's not a fix in config 1.3.2, then the |
I've found bug in https://github.com/puppetlabs/cpp-hocon/blob/master/lib/src/values/simple_config_object.cc#L32, must be checking for non-empty. |
Also found that method config_delayed_merge_object::resolve_substitutions was not implemented like here: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/ConfigDelayedMergeObject.java#L53 After fixing that I'm getting an exception 'should not be reached (merging non-simple_config_object)' in simple_config_object::merged_with_object on parsing following config:
|
One more bug in https://github.com/puppetlabs/cpp-hocon/blob/master/lib/inc/internal/values/config_delayed_merge_object.hpp#L10, class config_delayed_merge_object did not inherit from class unmergeable like here: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/ConfigDelayedMergeObject.java#L21 |
Here is my suggested patch: |
Open Merge Request #106 |
Thanks for digging into this! I'll work on reviewing the PRs. |
Fixes #96, #105. * Fix simple_config_object.cc Must be checking for non-empty in accordance to line in Java project: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/SimpleConfigObject.java#L364 * Fix config_delayed_merge_object.cc, config_delayed_merge_object.hpp The method config_delayed_merge_object::resolve_substitutions must be implemented like here: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/ConfigDelayedMergeObject.java#L53 Also the class config_delayed_merge_object must inherit from class unmergeable like here: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/ConfigDelayedMergeObject.java#L21 * Fix config_substitution_test.cc Fix expected results of tests. * Fix config_delayed_merge_object.cc Include definition of class resolve_result
I'm using the example from documentation: https://github.com/lightbend/config/blob/master/HOCON.md#examples-of-self-referential-substitutions
And I'm getting crash:
terminate called after throwing an instance of 'hocon::bug_or_broken_exception' what(): resolve_substitutions() did not give us a resolved object
Also I'm getting crash in cases below:
Looks like this library implementation doesn't follow the HOCON documentation...
The text was updated successfully, but these errors were encountered: