{"action":"created","issue":{"url":"https://api.github.com/repos/eXist-db/exist/issues/1960","repository_url":"https://api.github.com/repos/eXist-db/exist","labels_url":"https://api.github.com/repos/eXist-db/exist/issues/1960/labels{/name}","comments_url":"https://api.github.com/repos/eXist-db/exist/issues/1960/comments","events_url":"https://api.github.com/repos/eXist-db/exist/issues/1960/events","html_url":"https://github.com/eXist-db/exist/issues/1960","id":333603155,"node_id":"MDU6SXNzdWUzMzM2MDMxNTU=","number":1960,"title":"wrapping nodes using for-each after an arrow-operator","user":{"login":"line-o","id":657222,"node_id":"MDQ6VXNlcjY1NzIyMg==","avatar_url":"https://avatars0.githubusercontent.com/u/657222?v=4","gravatar_id":"","url":"https://api.github.com/users/line-o","html_url":"https://github.com/line-o","followers_url":"https://api.github.com/users/line-o/followers","following_url":"https://api.github.com/users/line-o/following{/other_user}","gists_url":"https://api.github.com/users/line-o/gists{/gist_id}","starred_url":"https://api.github.com/users/line-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/line-o/subscriptions","organizations_url":"https://api.github.com/users/line-o/orgs","repos_url":"https://api.github.com/users/line-o/repos","events_url":"https://api.github.com/users/line-o/events{/privacy}","received_events_url":"https://api.github.com/users/line-o/received_events","type":"User","site_admin":false},"labels":[{"id":49540768,"node_id":"MDU6TGFiZWw0OTU0MDc2OA==","url":"https://api.github.com/repos/eXist-db/exist/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"wolfgangmm","id":607433,"node_id":"MDQ6VXNlcjYwNzQzMw==","avatar_url":"https://avatars0.githubusercontent.com/u/607433?v=4","gravatar_id":"","url":"https://api.github.com/users/wolfgangmm","html_url":"https://github.com/wolfgangmm","followers_url":"https://api.github.com/users/wolfgangmm/followers","following_url":"https://api.github.com/users/wolfgangmm/following{/other_user}","gists_url":"https://api.github.com/users/wolfgangmm/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfgangmm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfgangmm/subscriptions","organizations_url":"https://api.github.com/users/wolfgangmm/orgs","repos_url":"https://api.github.com/users/wolfgangmm/repos","events_url":"https://api.github.com/users/wolfgangmm/events{/privacy}","received_events_url":"https://api.github.com/users/wolfgangmm/received_events","type":"User","site_admin":false},"assignees":[{"login":"wolfgangmm","id":607433,"node_id":"MDQ6VXNlcjYwNzQzMw==","avatar_url":"https://avatars0.githubusercontent.com/u/607433?v=4","gravatar_id":"","url":"https://api.github.com/users/wolfgangmm","html_url":"https://github.com/wolfgangmm","followers_url":"https://api.github.com/users/wolfgangmm/followers","following_url":"https://api.github.com/users/wolfgangmm/following{/other_user}","gists_url":"https://api.github.com/users/wolfgangmm/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfgangmm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfgangmm/subscriptions","organizations_url":"https://api.github.com/users/wolfgangmm/orgs","repos_url":"https://api.github.com/users/wolfgangmm/repos","events_url":"https://api.github.com/users/wolfgangmm/events{/privacy}","received_events_url":"https://api.github.com/users/wolfgangmm/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/eXist-db/exist/milestones/28","html_url":"https://github.com/eXist-db/exist/milestone/28","labels_url":"https://api.github.com/repos/eXist-db/exist/milestones/28/labels","id":3424653,"node_id":"MDk6TWlsZXN0b25lMzQyNDY1Mw==","number":28,"title":"eXist-4.2.2","description":"","creator":{"login":"adamretter","id":1264057,"node_id":"MDQ6VXNlcjEyNjQwNTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1264057?v=4","gravatar_id":"","url":"https://api.github.com/users/adamretter","html_url":"https://github.com/adamretter","followers_url":"https://api.github.com/users/adamretter/followers","following_url":"https://api.github.com/users/adamretter/following{/other_user}","gists_url":"https://api.github.com/users/adamretter/gists{/gist_id}","starred_url":"https://api.github.com/users/adamretter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamretter/subscriptions","organizations_url":"https://api.github.com/users/adamretter/orgs","repos_url":"https://api.github.com/users/adamretter/repos","events_url":"https://api.github.com/users/adamretter/events{/privacy}","received_events_url":"https://api.github.com/users/adamretter/received_events","type":"User","site_admin":false},"open_issues":56,"closed_issues":6,"state":"open","created_at":"2018-06-14T12:07:58Z","updated_at":"2018-07-03T12:28:02Z","due_on":"2018-08-06T07:00:00Z","closed_at":null},"comments":2,"created_at":"2018-06-19T10:03:59Z","updated_at":"2018-07-03T15:18:38Z","closed_at":null,"author_association":"NONE","body":"### What is the problem\r\n\r\nWrapping nodes in a function used in `fn:for-each` after an Arrow Operator incorrectly outputs one element per item in the source sequence.\r\n\r\n```xquery\r\nlet $xml := <root><i/><i/><i/></root>\r\nreturn\r\n    $xml/i => for-each(function ($i) { <wrap>{$i}</wrap> })\r\n```\r\n\r\nreturns\r\n\r\n```xml\r\n<wrap><i/><i/><i/></wrap>\r\n<wrap><i/><i/><i/></wrap>\r\n<wrap><i/><i/><i/></wrap>\r\n```\r\n\r\n### What did you expect\r\n\r\n```xml\r\n<wrap><i/></wrap>\r\n<wrap><i/></wrap>\r\n<wrap><i/></wrap>\r\n```\r\n\r\n### Describe how to reproduce or add a test\r\n\r\n2 tests:\r\n- *`ao:wrap-atomic-sequence`* does work\r\n- *`ao:wrap-element-sequence`* outputs 9 instead of 3\r\n\r\n```xquery\r\n\r\nxquery version \"3.1\";\r\n\r\nmodule namespace ao=\"http://exist-db.org/xquery/test/arrowop\";\r\ndeclare namespace test=\"http://exist-db.org/xquery/xqsuite\";\r\n\r\ndeclare\r\n\t%private\r\nfunction ao:wrap ($item as item()) as item() { \r\n    <wrap>{$item}</wrap>\r\n};\r\n\r\ndeclare\r\n\t%private \r\nfunction ao:first-element-text ($s as node()*) as text() {\r\n    $s[1]/text()\r\n};\r\n\r\ndeclare\r\n    %test:assertEquals(\"1\")\r\nfunction ao:wrap-atomic-sequence() {\r\n    (1, 2, 3) => for-each(ao:wrap#1) => ao:first-element-text()\r\n};\r\n\r\ndeclare\r\n\t%private \r\nfunction ao:get-i-elements ($i as item()) { $i//i };\r\n\r\ndeclare\r\n    %test:assertEquals(3)\r\nfunction ao:wrap-element-sequence () {\r\n    let $xml := <root><i/><i/><i/></root>\r\n    return $xml/node()\r\n        => for-each(ao:wrap#1)\r\n        => for-each(ao:get-i-elements#1)\r\n        => count()\r\n};\r\n```\r\n\r\n### Context information\r\n\r\n- Tested on 4.1.0 and 5.0.0-RC1 (8339007319a720c97733c1c35b30d6e20ff41c9d) \r\n- java version \"1.8.0_152\"\r\n- Operating system: MacOs (64 bit)\r\n- both are clones from GitHub\r\n- the 4.1.0 is a customised version of existdb \r\n"},"comment":{"url":"https://api.github.com/repos/eXist-db/exist/issues/comments/402194282","html_url":"https://github.com/eXist-db/exist/issues/1960#issuecomment-402194282","issue_url":"https://api.github.com/repos/eXist-db/exist/issues/1960","id":402194282,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjE5NDI4Mg==","user":{"login":"line-o","id":657222,"node_id":"MDQ6VXNlcjY1NzIyMg==","avatar_url":"https://avatars0.githubusercontent.com/u/657222?v=4","gravatar_id":"","url":"https://api.github.com/users/line-o","html_url":"https://github.com/line-o","followers_url":"https://api.github.com/users/line-o/followers","following_url":"https://api.github.com/users/line-o/following{/other_user}","gists_url":"https://api.github.com/users/line-o/gists{/gist_id}","starred_url":"https://api.github.com/users/line-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/line-o/subscriptions","organizations_url":"https://api.github.com/users/line-o/orgs","repos_url":"https://api.github.com/users/line-o/repos","events_url":"https://api.github.com/users/line-o/events{/privacy}","received_events_url":"https://api.github.com/users/line-o/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T15:18:38Z","updated_at":"2018-07-03T15:18:38Z","author_association":"NONE","body":"~~~xquery\r\n(1,2,3) => for-each(function ($a) {<a>{xs:string($a)}</a>})\r\n~~~\r\n\r\ndoes also trigger the behaviour while\r\n\r\n~~~xquery\r\n(1,2,3) => for-each(function ($a) {<a>{$a}</a>})\r\n~~~\r\n\r\ndoes not"}}
{"actor":{"display_login":"line-o"}}