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: objective-c declaration order wrong #13004

Closed
scisci opened this issue Oct 20, 2015 · 2 comments
Closed

x/mobile/bind: objective-c declaration order wrong #13004

scisci opened this issue Oct 20, 2015 · 2 comments

Comments

@scisci
Copy link

scisci commented Oct 20, 2015

Currently objective c declarations are alphabetically ordered which causes an error if a type is referenced before it is declared:

type StructThatStartsWithLetterBeforeZ struct {
        Value Z
}

type Z interface {
}

That will produce an error as follows:

In file included from GoLib.m:6:
./GoLib.h:18:7: error: no type or protocol named 'GoLibZ'
- (id<GoLibZ>)value;
      ^
./GoLib.h:19:22: error: no type or protocol named 'GoLibZ'
- (void)setValue:(id<GoLibZ>)v;
                     ^
GoLib.m:40:12: error: use of undeclared identifier 'GoLibZ'
                ret_ = [[GoLibZ alloc] initWithRef:ret__ref];
                         ^
GoLib.m:51:40: error: use of undeclared identifier 'GoLibZ'
        if ([(id<NSObject>)(v) isKindOfClass:[GoLibZ class]]) {
                                              ^
4 errors generated.

If it is the order, then perhaps pulling all protocol declarations to the top, or topological sort.

@scisci scisci changed the title x/mobile/bind: objective-c declaration order wrong when interface has method with same interface arg x/mobile/bind: objective-c declaration order wrong Oct 20, 2015
@hyangah hyangah added this to the Unreleased milestone Oct 21, 2015
@hyangah
Copy link
Contributor

hyangah commented Oct 21, 2015

forward declaration of protocols (like class) will fix it.

@hyangah hyangah self-assigned this Oct 21, 2015
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Oct 24, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Fixes golang/go#13004

Change-Id: I114cf3d7d970485d0609b1d7b497e232010e64df
Reviewed-on: https://go-review.googlesource.com/16155
Reviewed-by: David Crawshaw <crawshaw@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Fixes golang/go#13004

Change-Id: I114cf3d7d970485d0609b1d7b497e232010e64df
Reviewed-on: https://go-review.googlesource.com/16155
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@rsc rsc unassigned hyangah Jun 23, 2022
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