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: Functions with type alias parameters result in cryptic errors #13190

Closed
sridharv opened this issue Nov 9, 2015 · 2 comments
Closed

Comments

@sridharv
Copy link

sridharv commented Nov 9, 2015

Context:

go version devel +9172a1b
gomobile version +1452f03
On Mac OSX

I created a package with an exported function that had a parameter with a type alias as shown below.

package typealiasmissing

type Alias string

type Op struct {
    Id int
}

func (o *Op) PrintAlias(alias Alias) {
    println(alias)
}

When I run gomobile bind I get the following error:

/var/folders/x7/r_g4gq092fz_956f6hqq864w0000gn/T/gomobile-work-953337057/go_typealiasmissing/go_typealiasmissingmain.go:36: undefined: param_alias

The generated binding code is not generating any sequence unpacking code. I expected this to either succeed or to generate an error saying type aliases are not supported.

Here is a small package which can be used to reproduce the error:

go get github.com/sridharv/bugreports/typealiasmissing
gomobile bind github.com/sridharv/bugreports/typealiasmissing
@rakyll
Copy link
Contributor

rakyll commented Nov 9, 2015

cc/ @hyangah

@rakyll rakyll added this to the Unreleased milestone Nov 9, 2015
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Nov 10, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
error message example:

 gomobile: unsupported named type github.com/sridharv/bugreports/typealiasmissing.Alias

Objective-C and Java generation code currently panics, which need to be
fixed separately. (See TODO in bind/seq.go)

Fixes golang/go#13190

Change-Id: Ie46dc58ea800522b8ab7cb8ac662ad561e0ca82e
Reviewed-on: https://go-review.googlesource.com/16780
Reviewed-by: Burcu Dogan <jbd@google.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
error message example:

 gomobile: unsupported named type github.com/sridharv/bugreports/typealiasmissing.Alias

Objective-C and Java generation code currently panics, which need to be
fixed separately. (See TODO in bind/seq.go)

Fixes golang/go#13190

Change-Id: Ie46dc58ea800522b8ab7cb8ac662ad561e0ca82e
Reviewed-on: https://go-review.googlesource.com/16780
Reviewed-by: Burcu Dogan <jbd@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants