{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/17981","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/17981/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/17981/comments","events_url":"https://api.github.com/repos/golang/go/issues/17981/events","html_url":"https://github.com/golang/go/issues/17981","id":190400039,"number":17981,"title":"go/internal/gccgoimporter: type conversion expression not handled","user":{"login":"stjj89","id":3895885,"avatar_url":"https://avatars.githubusercontent.com/u/3895885?v=3","gravatar_id":"","url":"https://api.github.com/users/stjj89","html_url":"https://github.com/stjj89","followers_url":"https://api.github.com/users/stjj89/followers","following_url":"https://api.github.com/users/stjj89/following{/other_user}","gists_url":"https://api.github.com/users/stjj89/gists{/gist_id}","starred_url":"https://api.github.com/users/stjj89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stjj89/subscriptions","organizations_url":"https://api.github.com/users/stjj89/orgs","repos_url":"https://api.github.com/users/stjj89/repos","events_url":"https://api.github.com/users/stjj89/events{/privacy}","received_events_url":"https://api.github.com/users/stjj89/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"assignees":[{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/42","html_url":"https://github.com/golang/go/milestones/Go1.8Maybe","labels_url":"https://api.github.com/repos/golang/go/milestones/42/labels","id":1748849,"number":42,"title":"Go1.8Maybe","description":"","creator":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":178,"state":"open","created_at":"2016-05-04T23:40:26Z","updated_at":"2016-11-18T22:25:52Z","due_on":"2017-01-31T00:00:00Z","closed_at":null},"comments":1,"created_at":"2016-11-18T19:20:45Z","updated_at":"2016-11-18T22:55:16Z","closed_at":null,"body":"The parser in package gccgoimporter does not seem to handle type conversion expressions exported by gccgo. For example, the following constant:\r\n\r\n```go\r\ntype Units string\r\n\r\nconst Bits = Units(\"bits\")\r\n```\r\n\r\ngets exported by gccgo in a .gox file as a const value wrapped in a type conversion:\r\n\r\n```\r\nconst Bits <type 1 \"Units\" <type -16>> = convert(<type 1>, \"bits\");\r\n```\r\n\r\nWhen gccgoimporter tries to parse this const in [gccgoimporter.(*parser).parseConstValue](https://github.com/golang/go/blob/964639cc338db650ccadeafb7424bc8ebb2c0f6c/src/go/internal/gccgoimporter/parser.go#L250), it appears to only expect a constant string, literal, int, or float on the RHS of a const assignment, so we get the error:\r\n\r\n```\r\nimport error some/package/path:48:49 (byte offset = 10429): expected const value,\r\ngot Ident (\"convert\"))\r\n```\r\n\r\nThe importer in the gccgo frontend, however, handles this type conversion properly (see relevant source snippet [here](https://github.com/golang/gofrontend/blob/master/go/expressions.cc#L15451)).\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/261663667","html_url":"https://github.com/golang/go/issues/17981#issuecomment-261663667","issue_url":"https://api.github.com/repos/golang/go/issues/17981","id":261663667,"user":{"login":"gopherbot","id":8566911,"avatar_url":"https://avatars.githubusercontent.com/u/8566911?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T22:55:16Z","updated_at":"2016-11-18T22:55:16Z","body":"CL https://golang.org/cl/33412 mentions this issue."}}
{"actor":{"display_login":"gopherbot"}}