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: type checking succeeds/fails depending on declaration order #52698

Open
ddaa2000 opened this issue May 4, 2022 · 4 comments
Open

cmd/compile: type checking succeeds/fails depending on declaration order #52698

ddaa2000 opened this issue May 4, 2022 · 4 comments
Assignees
Labels
NeedsInvestigation
Milestone

Comments

@ddaa2000
Copy link

@ddaa2000 ddaa2000 commented May 4, 2022

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

$ go version
go version go1.18.1 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=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ddaa\AppData\Local\go-build
set GOENV=C:\Users\ddaa\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\ddaa\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\ddaa\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\programing\go\bugReview\go.mod
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\ddaa\AppData\Local\Temp\go-build2453048728=/tmp/go-build -gno-rec
ord-gcc-switches

What did you do?

this will cause a compiler error:
https://go.dev/play/p/Mhkjuojm1JF
while this will compile successfully:
https://go.dev/play/p/PLhiCvqhO4W

What did you expect to see?

Compiler should have same behavior on both programs.

What did you see instead?

The first will cause a compiler error while the second will compile successfully.

@blackgreen100
Copy link

@blackgreen100 blackgreen100 commented May 4, 2022

Looks similar to #52529

@dr2chase dr2chase added the NeedsInvestigation label May 4, 2022
@dr2chase dr2chase added this to the Backlog milestone May 4, 2022
@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented May 4, 2022

It's not the same bug, I just checked with current tip.
@griesemer, is this one for you?

@griesemer griesemer changed the title cmd/compile: inconsistent type parsing cmd/compile: type checking succeeds/fails depending on declaration order May 4, 2022
@griesemer griesemer self-assigned this May 4, 2022
@griesemer griesemer removed this from the Backlog milestone May 4, 2022
@griesemer griesemer added this to the Go1.19 milestone May 4, 2022
@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented May 20, 2022

I'm poking at this, but not yet very productively.

@gopherbot
Copy link

@gopherbot gopherbot commented May 26, 2022

Change https://go.dev/cl/408818 mentions this issue: cmd/compile: make validType0 walk/check more accurate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

5 participants