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: update interface been used as constraint error message. #49205

Open
komuw opened this issue Oct 28, 2021 · 3 comments
Open

cmd/compile: update interface been used as constraint error message. #49205

komuw opened this issue Oct 28, 2021 · 3 comments
Assignees
Milestone

Comments

@komuw
Copy link
Contributor

@komuw komuw commented Oct 28, 2021

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

$ go version
gotip version             
go version devel go1.18-a3bb28e5ff Thu Oct 28 14:25:03 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

N/A

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/homew/.cache/go-build"
GOENV="/home/homew/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/homew/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/homew/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/homew/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/homew/sdk/gotip/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.18-a3bb28e5ff Thu Oct 28 14:25:03 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/homew/Downloads/cool/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/run/user/1000/go-build4161629763=/tmp/go-build -gno-record-gcc-switches"

What did you do?

mistakenly write;

package main

type A interface {
	int  int64
}
func main() { }

What did you expect to see?

main.go:60:7: syntax error: unexpected int64, expecting semicolon or newline or | or }

What did you see instead?

main.go:60:7: syntax error: unexpected int64, expecting semicolon or newline or }

ie, Now that interfaces can be used as type constraints; the error message should probably include | as one of the expected tokens.

@komuw komuw changed the title update interface been used as constraint error message. cmd/compile: update interface been used as constraint error message. Oct 28, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 29, 2021

Change https://golang.org/cl/359655 mentions this issue: cmd/compile: update error message for interface that used as constraint

Loading

@dmitshur dmitshur added this to the Backlog milestone Oct 29, 2021
@mdempsky
Copy link
Member

@mdempsky mdempsky commented Nov 3, 2021

. and ( would also be valid tokens to appear after int. I'm not sure we need to be exhaustive in listing possible tokens.

Loading

@griesemer griesemer self-assigned this Nov 3, 2021
@griesemer griesemer removed this from the Backlog milestone Nov 9, 2021
@griesemer griesemer added this to the Go1.18 milestone Nov 9, 2021
@griesemer
Copy link
Contributor

@griesemer griesemer commented Nov 9, 2021

Marking for 1.18 if we get to it, otherwise fine to delay to 1.19.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants