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

go/types, types2: alias types are restricted to basic interfaces, should allow arbitrary interfaces #51616

Closed
zigo101 opened this issue Mar 11, 2022 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@zigo101
Copy link

zigo101 commented Mar 11, 2022

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

$ go version
go version go1.18rc1 linux/amd64

What did you do?

type C[T any] interface{~int; M() T}
type C1 = C[bool] // error
type C2 = comparable // error
type C3 = interface {~[]byte | ~string} // error

I didn't find this is documented in tip spec.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 11, 2022
@ianlancetaylor ianlancetaylor added this to the Go1.19 milestone Mar 11, 2022
@ianlancetaylor
Copy link
Contributor

CC @griesemer

@griesemer griesemer self-assigned this Mar 11, 2022
@griesemer
Copy link
Contributor

This is just a bug. I don't see a reason why there should be a restriction here. It's a trivial change but too late for 1.18.

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. and removed Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Mar 11, 2022
@griesemer griesemer changed the title spec: the fact that non-basic interfaces are not alias-able is not documented go/types, types2: alias types are restricted to basic interfaces, should allow arbitrary interfaces Mar 11, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/392715 mentions this issue: go/types, types2: alias type declarations may refer to constraint types

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants