-
Notifications
You must be signed in to change notification settings - Fork 18k
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: type checker does not allow to use receive operation even all types in type list are channels #43671
Comments
CC @griesemer |
This has not yet been implemented. |
I was about to file an issue about this when I found this one. I'll also mention that type inference doesn't work when the type parameters are omitted from |
@rogpeppe Type inference does work if you remove one of the channel types from RecvChan. That is because constraint type inference requires exactly one type in the type list/set. Channels with channel directions are a bit special; they may need some special treatment. I filed a separate issue (#45920). |
Change https://golang.org/cl/333709 mentions this issue: |
… is of type parameter type For #43671 Change-Id: I7db4b3886fab44ec0de7c0935e0ab21c26e3335c Reviewed-on: https://go-review.googlesource.com/c/go/+/333709 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Change https://golang.org/cl/335076 mentions this issue: |
Change https://golang.org/cl/335075 mentions this issue: |
…er type This is a port of CL 333709 to go/types, adjusted for the different error API. Fixes #43671 Change-Id: Ifd340149bfbcabe401cec74398cb83f2ae812e51 Reviewed-on: https://go-review.googlesource.com/c/go/+/335075 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
…meter type This is a port of CL 333712 to go/types, adjusted for the different error reporting API and to position errors on the arrows. Fixes #43671 Change-Id: I7d2de249e86d272c89a046f60e632e75848ff865 Reviewed-on: https://go-review.googlesource.com/c/go/+/335076 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This was fixed with the above CLs. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
n/a
What operating system and processor architecture are you using (
go env
)?windows/amd64
What did you do?
https://go2goplay.golang.org/p/4ERkDYXAVM-
Also, I got same result from
dev.typeparams
typechecker usingThe problem is here
go/src/cmd/compile/internal/types2/expr.go
Lines 156 to 172 in f065ff2
x.typ.Chan()
returnsnil
ifx.typ
is a*TypeParam
.What did you expect to see?
Successful type-check or a stub error like
generic slice expressions not yet implemented
. All types inRecvChan[T]
type list support receive operation.What did you see instead?
An error
The text was updated successfully, but these errors were encountered: