Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/internal/gccgoimporter: type conversion expression not handled #17981

Closed
stjj89 opened this issue Nov 18, 2016 · 1 comment
Closed

go/internal/gccgoimporter: type conversion expression not handled #17981

stjj89 opened this issue Nov 18, 2016 · 1 comment
Labels
FrozenDueToAge NeedsFix
Milestone

Comments

@stjj89
Copy link
Contributor

@stjj89 stjj89 commented Nov 18, 2016

The parser in package gccgoimporter does not seem to handle type conversion expressions exported by gccgo. For example, the following constant:

type Units string

const Bits = Units("bits")

gets exported by gccgo in a .gox file as a const value wrapped in a type conversion:

const Bits <type 1 "Units" <type -16>> = convert(<type 1>, "bits");

When gccgoimporter tries to parse this const in gccgoimporter.(*parser).parseConstValue, it appears to only expect a constant string, literal, int, or float on the RHS of a const assignment, so we get the error:

import error some/package/path:48:49 (byte offset = 10429): expected const value,
got Ident ("convert"))

The importer in the gccgo frontend, however, handles this type conversion properly (see relevant source snippet here).

@griesemer griesemer self-assigned this Nov 18, 2016
@quentinmit quentinmit added the NeedsFix label Nov 18, 2016
@quentinmit quentinmit added this to the Gccgo milestone Nov 18, 2016
@quentinmit quentinmit added this to the Go1.8Maybe milestone Nov 18, 2016
@quentinmit quentinmit removed this from the Gccgo milestone Nov 18, 2016
@quentinmit quentinmit changed the title gccgoimporter: type conversion expression not handled go/internal/gccgoimporter: type conversion expression not handled Nov 18, 2016
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 18, 2016

CL https://golang.org/cl/33412 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix
Projects
None yet
Development

No branches or pull requests

4 participants