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

x/mobile/bind: panic on alias to builtin type (e.g. string) #29559

Closed
libnat opened this issue Jan 4, 2019 · 2 comments
Closed

x/mobile/bind: panic on alias to builtin type (e.g. string) #29559

libnat opened this issue Jan 4, 2019 · 2 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@libnat
Copy link

libnat commented Jan 4, 2019

What version of Go are you using (go version)?

go version go1.11.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

What did you do?

// hello.go

package hello
type DeviceType = string

Run: gomobile bind -target=ios .

What did you expect to see?

Succeeded to generate objc framework

What did you see instead?

panic: interface conversion: types.Type is *types.Basic, not *types.Named

goroutine 1 [running]:
golang.org/x/mobile/bind.(*Generator).Init(0xc0000b6dc0)
        /Users/gopher/go/src/golang.org/x/mobile/bind/gen.go:149 +0x1313
golang.org/x/mobile/bind.GenGo(0xc000022a00, 0x1b, 0x137cdc0)
        /Users/gopher/go/src/golang.org/x/mobile/bind/bind.go:45 +0x1a4
main.genPkg(0x7ffeefbff74d, 0x2, 0xc00000f810, 0xc00000c190, 0x1, 0x1, 0xc00000c118, 0x1, 0x1, 0x0, ...)
        /Users/gopher/go/src/golang.org/x/mobile/cmd/gobind/gen.go:116 +0x1dce
main.run()
        /Users/gopher/go/src/golang.org/x/mobile/cmd/gobind/main.go:158 +0xa27
main.main()
        /Users/gopher/go/src/golang.org/x/mobile/cmd/gobind/main.go:45 +0x27
@gopherbot gopherbot added this to the Unreleased milestone Jan 4, 2019
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jan 4, 2019
@libnat
Copy link
Author

libnat commented Jan 4, 2019

It's OK for alias to named type, doesn't work for alias to builtin type. Thanks:)

@gopherbot
Copy link

Change https://golang.org/cl/159417 mentions this issue: bind: ignore type aliases to basic types

@golang golang locked and limited conversation to collaborators Jan 25, 2020
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Fixes golang/go#29559

Change-Id: Iffaac239e5c9a9e53f4e292b4d9bf669d5084e1f
GitHub-Last-Rev: c5d4a48
GitHub-Pull-Request: golang#25
Reviewed-on: https://go-review.googlesource.com/c/159417
Reviewed-by: Elias Naur <mail@eliasnaur.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Fixes golang/go#29559

Change-Id: Iffaac239e5c9a9e53f4e292b4d9bf669d5084e1f
GitHub-Last-Rev: c5d4a48
GitHub-Pull-Request: golang#25
Reviewed-on: https://go-review.googlesource.com/c/159417
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

2 participants