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: gccgoBuiltin{BYTE,RUNE} map to {uint8,int32} types instead of {byte,rune} aliases #11762

mdempsky opened this issue Jul 17, 2015 · 5 comments


Copy link

@mdempsky mdempsky commented Jul 17, 2015

In go/internal/gccgoimporter's lookupBuiltinType function, there are these lines:

661         gccgoBuiltinBYTE:       types.Typ[types.Byte],
662         gccgoBuiltinRUNE:       types.Typ[types.Rune],

However, in go/types, Byte and Rune are defined as:

const (
    Invalid BasicKind = iota // type is invalid

    /* ... */

    // aliases
    Byte = Uint8
    Rune = Int32

so types.Typ[types.Byte] actually evaluates to the *types.Basic representing the universal uint8 type rather than for the desired universal byte type. uint8 and byte are aliases and generally treated as identical, but they still have distinct *types.Basic representations (e.g., so they can each be printed appropriately). Thus gccgoBuiltinBYTE should actually map to something like types.UniverseByte or types.Universe.Lookup("byte").Type().

Similarly, gccgoBuiltinRUNE should map to either types.UniverseRune or types.Universe.Lookup("rune").Type().

Copy link
Member Author

@mdempsky mdempsky commented Jul 17, 2015

/cc @ianlancetaylor @griesemer

Copy link

@gopherbot gopherbot commented Jul 17, 2015

CL mentions this issue.

Copy link
Member Author

@mdempsky mdempsky commented Jul 18, 2015

@robpike I've edited the issue description. Hopefully it's clearer now.

Copy link

@griesemer griesemer commented Jul 20, 2015

@mdempsky Please separate the fix into a stand-alone change.

Copy link

@gopherbot gopherbot commented Jul 21, 2015

CL mentions this issue.

@mikioh mikioh added this to the Go1.5 milestone Jul 21, 2015
@golang golang locked and limited conversation to collaborators Jul 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

4 participants