Skip to content

cmd/compile: compilation results for generic types are affected by the filename #51048

@sxyazi

Description

@sxyazi

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

$ go version
go version go1.18beta2 linux/arm64

Does this issue reproduce with the latest release?

Yes, it can be reproduced in the latest beta version. The minimal reproducible code I put at https://github.com/sxyazi/awesomeProject

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/root/sdk/go1.18beta2"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/root/sdk/go1.18beta2/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.18beta2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/www/awesomeProject/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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3302494008=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I executed go test, but it got an error. When I changed the file name from foo.go to hello.go, it worked correctly again. I suspect it has something to do with the compilation order of the filenames.

reproducing

What did you expect to see?

Pass the test correctly

What did you see instead?

./foo.go:14:13: T does not implement []E ([]E is not an interface)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions