Closed as not planned
Description
What version of Go are you using (go version
)?
$ go version 1.19
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/varun/Library/Caches/go-build" GOENV="/Users/varun/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/varun/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/varun/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/varun/.asdf/installs/golang/1.19/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/varun/.asdf/installs/golang/1.19/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.19" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/varun/Code/scip/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tr/gylnxkts3bn0gyhhlrv8z9_m0000gn/T/go-build325381962=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Try to compile this file:
type X[T] struct {
t T
}
func main() {}
What did you expect to see?
A useful error message, something like: (IDK if 'constraint' is the right verbiage)
./tmp.go:2:8: missing type constraint for 'T'; explicitly specify 'T any' if T doesn't have any constraints
There shouldn't be an error on line 3 because it is not useful.
What did you see instead?
An error which doesn't clearly indicate the problem:
./tmp.go:2:8: undeclared name T for array length
./tmp.go:3:4: undefined: T