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: cannot handle alias type declaration #40655

Closed
ZenLiuCN opened this issue Aug 8, 2020 · 1 comment
Closed

cmd/compile: cannot handle alias type declaration #40655

ZenLiuCN opened this issue Aug 8, 2020 · 1 comment

Comments

@ZenLiuCN
Copy link

ZenLiuCN commented Aug 8, 2020

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

go version go1.14.2 windows/amd64.

Does this issue reproduce with the latest release?

haven check yet.

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

go env Output
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\gosrc\src
set GOPRIVATE=
set GOPROXY=http://goproxy.cn
set GOROOT=D:\golang
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\golang\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\src\mrp\go.mod
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build890466410=/tmp/go-build -gno-record-gcc-switches

What did you do?

  1. with go mod enabled
  2. with those file in same package
// some_file.go
package mrp
type Runtime interface {
	RevertThen(i int, fragment Fragment)
}
type (
	Fragment             = func(Runtime) bool
)
//Rutime.go
package mrp

type runtime struct {
	stack     []interface{}
	revert    int
	revertPtr int
	parameter map[string]interface{}
}

func (r runtime) RevertThen(i int, fragment Fragment) {
	panic("implement me")
}

What did you see instead?

.\some_file.go:5:2: internal compiler error: cannot handle alias type declaration (issue #25838): Fragment

this will and only will happend under :

  1. implment file is name within upper-case;
  2. interface is defined in separate file, and this file contains no upper-case ;
@mdempsky
Copy link
Member

mdempsky commented Aug 8, 2020

Thanks for providing more details. I think this is #25838 actually. Here's a standalone file that produces the same failure: https://play.golang.org/p/0Cxmszie2hW

Case is relevant because it probably affects how cmd/go sorts file names, which affects the order that cmd/compile processes declarations. I think if you put the interface after the implementation in your file, it'll still reproduce too.

Closing as a duplicate.

@mdempsky mdempsky closed this as completed Aug 8, 2020
@golang golang locked and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants