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: confusing compilation error on receiver and type parameter names clash #52867

Closed
nd opened this issue May 12, 2022 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@nd
Copy link
Contributor

nd commented May 12, 2022

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

$ go version
go version go1.18 windows/amd64

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
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\nd\AppData\Local\go-build
set GOENV=C:\Users\nd\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=c:\Users\nd\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=c:/Users/nd/go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\Users\nd\go\go1.18
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\Users\nd\go\go1.18\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\nd\AppData\Local\Temp\go-build1852737176=/tmp/go-build -gno-record-gcc-switches

What did you do?

Compiled a program https://go.dev/play/p/njRo_BEKTXG?v=gotip

What did you expect to see?

Error reporting type name clash in receiver.

What did you see instead?

The X is not a generic type error, as if the receiver X was resolved to its type parameter X.

@nd nd changed the title affected/package: Confusing compilation error on receiver and type parameter names clash May 12, 2022
@heschi
Copy link
Contributor

heschi commented May 12, 2022

cc @findleyr @griesemer

@heschi heschi added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 12, 2022
@heschi heschi added this to the Backlog milestone May 12, 2022
@heschi heschi changed the title Confusing compilation error on receiver and type parameter names clash cmd/compile: confusing compilation error on receiver and type parameter names clash May 12, 2022
@griesemer
Copy link
Contributor

This program should compile without error per the latest spec changes (see scope of type parameters).

Agreed that this is a bug, but also: don't do this. Give type parameters different names even if this code is permitted.

Duplicate of #51503. Closing.

(This may or may not get fixed for 1.19 as it's not urgent.)

@golang golang locked and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants