check.invalidOpf(x, "cannot receive from non-channel %s", x)
x.mode=invalid
return
}
iftyp.dir==SendOnly {
check.invalidOpf(x, "cannot receive from send-only channel %s", x)
x.mode=invalid
return
}
x.mode=commaok
x.typ=typ.elem
check.hasCallOrRecv=true
return
}
x.typ.Chan() returns nil if x.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 in RecvChan[T] type list support receive operation.
What did you see instead?
An error
invalid operation: cannot receive from non-channel ch (variable of type parameter type C)
The text was updated successfully, but these errors were encountered:
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: