{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/23781","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/23781/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/23781/comments","events_url":"https://api.github.com/repos/golang/go/issues/23781/events","html_url":"https://github.com/golang/go/issues/23781","id":296212739,"number":23781,"title":"cmd/compile: imperfect error message for too large index in slice composite literal","user":{"login":"dotaheor","id":25079101,"avatar_url":"https://avatars3.githubusercontent.com/u/25079101?v=4","gravatar_id":"","url":"https://api.github.com/users/dotaheor","html_url":"https://github.com/dotaheor","followers_url":"https://api.github.com/users/dotaheor/followers","following_url":"https://api.github.com/users/dotaheor/following{/other_user}","gists_url":"https://api.github.com/users/dotaheor/gists{/gist_id}","starred_url":"https://api.github.com/users/dotaheor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotaheor/subscriptions","organizations_url":"https://api.github.com/users/dotaheor/orgs","repos_url":"https://api.github.com/users/dotaheor/repos","events_url":"https://api.github.com/users/dotaheor/events{/privacy}","received_events_url":"https://api.github.com/users/dotaheor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-11T18:28:13Z","updated_at":"2018-02-11T18:28:13Z","closed_at":null,"author_association":"NONE","body":"### What version of Go are you using (`go version`)?\r\n\r\ngo version go1.9.3 linux/amd64\r\n\r\n### Does this issue reproduce with the latest release?\r\n\r\nyes\r\n\r\n### What did you do?\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n)\r\n\r\nfunc main() {\r\n\tfmt.Println(\"Hello, playground\")\r\n\tconst k int64 = 1 << 31\r\n\t_ = []int{k:1} // error: index must be non-negative integer constant\r\n}\r\n```\r\n\r\n### What did you expect to see?\r\n\r\ncompile ok, or with error\r\n```\r\n./a.go:10:13: index is too large\r\n```\r\n\r\n### What did you see instead?\r\n\r\nfail to compile, with error\r\n```\r\n./a.go:10:13: index must be non-negative integer constant\r\n```\r\n\r\nFrom Go spec. (in array and slice literals)\r\n```\r\nThe key must be a non-negative constant representable by a value of type int;\r\nand if it is typed it must be of integer type. \r\n```\r\n\r\n`1 << 31` is representable by a value of type int on 64-bit OS, and it is non-negative."}}
{"actor":{"display_login":"dotaheor"}}