{"action":"created","issue":{"url":"https://api.github.com/repos/chimpler/pyhocon/issues/62","labels_url":"https://api.github.com/repos/chimpler/pyhocon/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/chimpler/pyhocon/issues/62/comments","events_url":"https://api.github.com/repos/chimpler/pyhocon/issues/62/events","html_url":"https://github.com/chimpler/pyhocon/issues/62","id":114628637,"number":62,"title":"list variable substitution","user":{"login":"kevin1294","id":15614410,"avatar_url":"https://avatars.githubusercontent.com/u/15614410?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin1294","html_url":"https://github.com/kevin1294","followers_url":"https://api.github.com/users/kevin1294/followers","following_url":"https://api.github.com/users/kevin1294/following{/other_user}","gists_url":"https://api.github.com/users/kevin1294/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin1294/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin1294/subscriptions","organizations_url":"https://api.github.com/users/kevin1294/orgs","repos_url":"https://api.github.com/users/kevin1294/repos","events_url":"https://api.github.com/users/kevin1294/events{/privacy}","received_events_url":"https://api.github.com/users/kevin1294/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chimpler/pyhocon/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-02T16:17:31Z","updated_at":"2015-11-13T10:04:22Z","closed_at":null,"body":"\r\nI'm seeing a strange issue that has to do with lists and variable substitution.  I verified that I was using the code from version 0.3.15 but the problem still persists.  I'm wondering if this has something to do with config_parser.py checking if a value is a ConfigValues instance, instead of checking whether the value is a ConfigValues instance *OR* is a list that contains a ConfigValues instance (or a list of lists, etc.).\r\n\r\n\r\n```python\r\nfrom pyhocon import ConfigFactory\r\n\r\n# OUTPUT USING version 0.3.15\r\n#\r\n# >>> execfile(\"pyhocon_test.py\")\r\n# >>> count_incorrect()\r\n#  23 /  100 entries are bad for config 1, key: group1.list\r\n#    bad entries: [\"[[ConfigValues: a], 'b', 'c', 'd']\"]\r\n#   0 /  100 entries are bad for config 1, key: group2.list\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 2, key: group1.list\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 2, key: group2.single\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 3, key: group1.list\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 3, key: group2.list\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 4, key: group1.list\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 5, key: group1.single2\r\n#    bad entries: []\r\n#   0 /  100 entries are bad for config 5, key: group2.single2\r\n#    bad entries: []\r\n\r\n\r\n# there is an intermittent issue parsing this config string\r\nTEST_CONFIG1 = \"\"\"\r\n{\r\n  group1 {\r\n    single = a\r\n    list = [${group1.single}, \"b\", \"c\", \"d\"]   # !!! this can be incorrectly parsed !!!\r\n  }\r\n  group2 {\r\n    list = ${group1.list}\r\n  }\r\n}\r\n\"\"\"\r\n\r\n# similar to TEST_CONFIG1 but group2 refers to group1.single instead of group1.list\r\nTEST_CONFIG2 = \"\"\"\r\n{\r\n  group1 {\r\n    single = a\r\n    list = [${group1.single}, \"b\", \"c\", \"d\"]\r\n  }\r\n  group2 {\r\n    single = ${group1.single}\r\n  }\r\n}\r\n\"\"\"\r\n\r\n# similar to TEST_CONFIG1 but group1.list does not have a variable substitution\r\nTEST_CONFIG3 = \"\"\"\r\n{\r\n  group1 {\r\n    single = a\r\n    list = [\"a\", \"b\", \"c\", \"d\"]\r\n  }\r\n  group2 {\r\n    list = ${group1.list}\r\n  }\r\n}\r\n\"\"\"\r\n\r\n# similar to TEST_CONFIG1 but there is no group2\r\nTEST_CONFIG4 = \"\"\"\r\n{\r\n  group1 {\r\n    single = a\r\n    list = [${group1.single}, \"b\", \"c\", \"d\"]\r\n  }\r\n}\r\n\"\"\"\r\n\r\n# similar to TEST_CONFIG1 but there there are no list definitions\r\nTEST_CONFIG5 = \"\"\"\r\n{\r\n  group1 {\r\n    single = a\r\n    single2 = ${group1.single}\r\n  }\r\n  group2 {\r\n    single2 = ${group1.single2}\r\n  }\r\n}\r\n\"\"\"\r\n\r\n\r\nTEST_LIST = [\r\n  (1, TEST_CONFIG1, 'group1.list', ['a', 'b', 'c', 'd']),\r\n  (1, TEST_CONFIG1, 'group2.list', ['a', 'b', 'c', 'd']),\r\n  (2, TEST_CONFIG2, 'group1.list', ['a', 'b', 'c', 'd']),\r\n  (2, TEST_CONFIG2, 'group2.single', 'a'),\r\n  (3, TEST_CONFIG3, 'group1.list', ['a', 'b', 'c', 'd']),\r\n  (3, TEST_CONFIG3, 'group2.list', ['a', 'b', 'c', 'd']),\r\n  (4, TEST_CONFIG4, 'group1.list', ['a', 'b', 'c', 'd']),\r\n  (5, TEST_CONFIG5, 'group1.single2', 'a'),\r\n  (5, TEST_CONFIG5, 'group2.single2', 'a'),\r\n]\r\n\r\ndef count_incorrect():\r\n  for (config_id, config_str, key, correct_entry) in TEST_LIST:\r\n    bad_count = 0\r\n    bad_entries = set()\r\n    total_count = 100\r\n    for i in range(total_count):\r\n      config = ConfigFactory.parse_string(config_str)\r\n      entry = config.get(key)\r\n      if entry != correct_entry:\r\n        bad_count += 1\r\n        bad_entries |= set([repr(entry)])\r\n    print \"%4d / %4d entries are bad for config %d, key: %s\" % (bad_count, total_count, config_id, key)\r\n    print \"    bad entries: %s\" % (list(bad_entries),)\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/chimpler/pyhocon/issues/comments/156383560","html_url":"https://github.com/chimpler/pyhocon/issues/62#issuecomment-156383560","issue_url":"https://api.github.com/repos/chimpler/pyhocon/issues/62","id":156383560,"user":{"login":"virgil-palanciuc","id":2854915,"avatar_url":"https://avatars.githubusercontent.com/u/2854915?v=3","gravatar_id":"","url":"https://api.github.com/users/virgil-palanciuc","html_url":"https://github.com/virgil-palanciuc","followers_url":"https://api.github.com/users/virgil-palanciuc/followers","following_url":"https://api.github.com/users/virgil-palanciuc/following{/other_user}","gists_url":"https://api.github.com/users/virgil-palanciuc/gists{/gist_id}","starred_url":"https://api.github.com/users/virgil-palanciuc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virgil-palanciuc/subscriptions","organizations_url":"https://api.github.com/users/virgil-palanciuc/orgs","repos_url":"https://api.github.com/users/virgil-palanciuc/repos","events_url":"https://api.github.com/users/virgil-palanciuc/events{/privacy}","received_events_url":"https://api.github.com/users/virgil-palanciuc/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T10:04:22Z","updated_at":"2015-11-13T10:04:22Z","body":"FWIW, https://github.com/chimpler/pyhocon/pull/65 also fixes this bug.\r\n"}}