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

gccgo: "incompatible type in initialization" is too vague #10402

Open
h4ck3rm1k3 opened this issue Apr 10, 2015 · 12 comments

Comments

@h4ck3rm1k3
Copy link

commented Apr 10, 2015

The error "incompatible type in initialization" is not very informative, here is a simple patch that of course could be better but shows the error.

h4ck3rm1k3/gcc-1@ba78452

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 10, 2015

@rsc rsc changed the title GCC Go, need more informative error messages gccgo: "incompatible type in initialization" is too vague Apr 10, 2015

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2015

Thanks, but dumping the mangled name is worse, not better.

The right fix is to write a type printing routine, and then use it in a bunch of places. That is not hard, but nobody has done it. Want to try?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2015

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 10, 2015

Sure, I can manage that. For my purpose the mangled name was better because It found the problem. I will look into a better typename function.

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 10, 2015

h4ck3rm1k3/gcc-1@d51d1f9 here is a first stab at a set of name methods. needs a lot of work to make it perfect.

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 10, 2015

It is going to need a test suite as well, I suppose the dumper code would be the way to run it on all different types.

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 11, 2015

maybe you can give me a tip @ianlancetaylor how to get the original package name from the identifier?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2015

Sorry, I'm not sure which kind of identifier you mean. Give me an example.

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 11, 2015

I think I have it. Basically inside of a give type I would like to get the named_object.name and package information. It seems that I might need access to the gogo object from inside the type. I am studying the code now, and am very impressed by your work to structure the code in C++. Will figure it out. thanks.

@paranoiacblack

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2015

I'm not sure if you resolved this or not but you can only get a named object from a named type. Named objects also have package information. For unnamed types, you'll have to do something different. Also I noticed h4ck3rm1k3/gcc-1@d51d1f9#diff-6dfba358043a87274c856db299475389R4071 doesn't seem right to me. ...interface{} isn't the only var args type. Ideally, that would also be "...%s", type->name()

@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 15, 2015

Thanks for your feedback, I will fix that.

I am still working on it a bit. Now I got the compiler bootrstrapped having fun actually programming in go.

I figured out how to get the names and the packages names. Still need more work on this.

h4ck3rm1k3 pushed a commit to h4ck3rm1k3/gcc-1 that referenced this issue Apr 15, 2015
@h4ck3rm1k3

This comment has been minimized.

Copy link
Author

commented Apr 15, 2015

my lastest work is here
https://github.com/h4ck3rm1k3/gcc-1/tree/go-dump-name-fix-1

Still need more work. Ideally would like to have a test case that would have a full coverage of the types in it for ast dump.

@ALTree ALTree modified the milestones: Gccgo, Unplanned Feb 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.