{"action":"created","issue":{"url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/123","labels_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/123/comments","events_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/123/events","html_url":"https://github.com/jandecaluwe/myhdl/issues/123","id":102384665,"number":123,"title":"[bug] Inconsistent Hierarchy returning list of generators","user":{"login":"cfelton","id":766391,"avatar_url":"https://avatars.githubusercontent.com/u/766391?v=3","gravatar_id":"","url":"https://api.github.com/users/cfelton","html_url":"https://github.com/cfelton","followers_url":"https://api.github.com/users/cfelton/followers","following_url":"https://api.github.com/users/cfelton/following{/other_user}","gists_url":"https://api.github.com/users/cfelton/gists{/gist_id}","starred_url":"https://api.github.com/users/cfelton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfelton/subscriptions","organizations_url":"https://api.github.com/users/cfelton/orgs","repos_url":"https://api.github.com/users/cfelton/repos","events_url":"https://api.github.com/users/cfelton/events{/privacy}","received_events_url":"https://api.github.com/users/cfelton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jandecaluwe","id":1984236,"avatar_url":"https://avatars.githubusercontent.com/u/1984236?v=3","gravatar_id":"","url":"https://api.github.com/users/jandecaluwe","html_url":"https://github.com/jandecaluwe","followers_url":"https://api.github.com/users/jandecaluwe/followers","following_url":"https://api.github.com/users/jandecaluwe/following{/other_user}","gists_url":"https://api.github.com/users/jandecaluwe/gists{/gist_id}","starred_url":"https://api.github.com/users/jandecaluwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jandecaluwe/subscriptions","organizations_url":"https://api.github.com/users/jandecaluwe/orgs","repos_url":"https://api.github.com/users/jandecaluwe/repos","events_url":"https://api.github.com/users/jandecaluwe/events{/privacy}","received_events_url":"https://api.github.com/users/jandecaluwe/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-08-21T13:56:31Z","updated_at":"2015-10-01T15:35:29Z","closed_at":null,"body":"A subtle error occurs, in some scenarios, when a list of generators is returned.  The following captures the slight differences\r\n\r\n```python\r\ndef mod1():\r\n    # ...\r\n    return gen1\r\n\r\ndef mod2():\r\n    # ...\r\n    return [gen2]\r\n\r\ndef top():\r\n    mod_insts = []\r\n    mod_insts += [mod1()]   # this works\r\n    mod_insts += mod2()     # this doesn't work \r\n```\r\n\r\nThis appears to only occur when a single generator is being returned.  [This test](https://github.com/cfelton/myhdl/blob/hier_list_error/myhdl/test/bugs/test_issue_123_2.py) demonstrates the error."},"comment":{"url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/comments/144764514","html_url":"https://github.com/jandecaluwe/myhdl/issues/123#issuecomment-144764514","issue_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/123","id":144764514,"user":{"login":"cfelton","id":766391,"avatar_url":"https://avatars.githubusercontent.com/u/766391?v=3","gravatar_id":"","url":"https://api.github.com/users/cfelton","html_url":"https://github.com/cfelton","followers_url":"https://api.github.com/users/cfelton/followers","following_url":"https://api.github.com/users/cfelton/following{/other_user}","gists_url":"https://api.github.com/users/cfelton/gists{/gist_id}","starred_url":"https://api.github.com/users/cfelton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfelton/subscriptions","organizations_url":"https://api.github.com/users/cfelton/orgs","repos_url":"https://api.github.com/users/cfelton/repos","events_url":"https://api.github.com/users/cfelton/events{/privacy}","received_events_url":"https://api.github.com/users/cfelton/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T15:35:29Z","updated_at":"2015-10-01T15:35:29Z","body":"\r\nUgh, that is a tough one ... \r\n\r\nWhen I originally reported this I took part of a day to add some additional [debug information](https://github.com/jandecaluwe/myhdl/compare/master...cfelton:issue_123_hier_list_error)  (the original effort was [here](https://github.com/jandecaluwe/myhdl/compare/master...cfelton:hier_list_error) but the git history was junk and I had to clean it up).  I took a swag at adding a `dump_hierarchy` function, it produces something like:\r\n\r\n    Hierarchy for \"fft_permute_top\"\r\n       :fft_permute_top(128) [ 80, 192]\r\n           returns rtl_s2p, rtl_permute\r\n         +fft_permute(192)  has 0, 2, 2\r\n             returns rtl_permute\r\n\r\n\r\nAlso added some tests, the following is a dump for one of the **list.extend** failures:\r\n\r\n    Hierarchy for \"list_of_interfaces_top_2\"\r\n    Hierarchy Error: <gen list?> <class 'list'> (68300424) missing\r\n    Inconsistent hierarchy - are all instances returned ?\r\n       :list_of_interfaces_top_2(232) [656, 304, 328, 720, 488, 984, 600]\r\n           returns rtl, rtl, rtl, rtl, rtl, rtl, rtl\r\n         :mod_with_interface_2(424) [600]\r\n             returns rtl\r\n         :mod_with_interface_2(120) [984]\r\n             returns rtl\r\n         :mod_with_interface_2(208) [488]\r\n             returns rtl\r\n         :mod_with_interface_2(168) [720]\r\n             returns rtl\r\n         :mod_with_interface_2(752) [328]\r\n             returns rtl\r\n         :mod_with_interface_2(840) [304]\r\n             returns rtl\r\n         :mod_with_interface_2(816) [656]\r\n             returns rtl\r\n\r\n    Hierarchy Error: <gen list?> <class 'list'> (58747208) missing\r\n\r\nI realize the dump is a little cryptic, I figured it needed to be compact, especially for larger designs.  I would need to add documentation (to the manual?) if we decided this was useful.   \r\n\r\nSince this isn't really a bug (current limitation?) I should move the tests I added to `core` (?) and catch the error.  In the future, as you suggest, someone can walk through all the cases and propose useful messages.  If we want this feature I can create a PR when complete.\r\n"}}