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

cmd/compile: move most (*Type).IsFoo methods to (EType).IsFoo #16929

mdempsky opened this issue Aug 30, 2016 · 0 comments


Copy link

@mdempsky mdempsky commented Aug 30, 2016

In type.go, we have a bunch of helper methods like IsInteger, IsSigned, IsPtrShaped, etc. that currently can only be used on specific types (i.e., *Type), but many of these are really properties of type kinds (EType). This is annoying in parts of the compiler where we don't care about type identity anymore, but would still care about properties like signedness/etc.

I think we should change Type's Etype EType field into an embedding of EType and change these method's receiver parameters from *Type to EType.

Some need to stay on *Type though; notably IsEmptyInterface and IsUntyped, because they depend on properties of the specific type.

It's a bit redundant for the single-kind methods like IsMap to be moved to EType, but for consistency we might as well move them too.

Filing as an issue in case anyone objects or has alternative proposals.

@mdempsky mdempsky self-assigned this Aug 30, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Sep 6, 2016
@quentinmit quentinmit added the NeedsFix label Oct 11, 2016
@rsc rsc modified the milestones: Go1.9Early, Go1.8 Oct 21, 2016
@bradfitz bradfitz modified the milestones: Go1.10Early, Go1.9Early May 3, 2017
@bradfitz bradfitz modified the milestones: Go1.10Early, Go1.10 Jun 14, 2017
@bradfitz bradfitz modified the milestones: Go1.10, Unplanned Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.