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

Array concatenation missing checks #685

Open
carueda opened this issue May 6, 2020 · 1 comment
Open

Array concatenation missing checks #685

carueda opened this issue May 6, 2020 · 1 comment

Comments

@carueda
Copy link
Contributor

carueda commented May 6, 2020

I'm reviewing HOCON's array-and-object-concatenation and wondering what the expected parse result should be for "wrong" inputs like the following:

  1. list = [0, 1] | [2,3]
  2. list = [0] bar baz [1,2,3]
  3. list = [0] abc [bar, baz] ||| xyz [1,2,3]

Per the rendering program below, the non-array tokens in between the arrays seem to just be silently ignored:

  1. list = [0, 1] | [2,3]:

     {
         "list" : [
             0,
             1,
             2,
             3
         ]
     }
    
  2. list = [0] bar baz [1,2,3]:

     {
         "list" : [
             0,
             1,
             2,
             3
         ]
     }
    
  3. list = [0] abc [bar, baz] ||| xyz [1,2,3]:

     {
         "list" : [
             0,
             "bar",
             "baz",
             1,
             2,
             3
         ]
     }
    

Shouldn't an exception be thrown in these cases? Thanks.


Config c = ConfigFactory.parseString(input).resolve();
ConfigRenderOptions options = ConfigRenderOptions.defaults().setOriginComments(false);
System.out.println(c.root().render(options));
@havocp
Copy link
Collaborator

havocp commented May 6, 2020

Without carefully re-reading the spec and code, my first impression is that I agree with you, I would expect an exception in these cases.

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

2 participants