Skip to content

cmd/compile: cannot handle alias type declaration  #40655

Closed

Description

@ZenLiuCN

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 ;

Activity

  1. mdempsky commented on Aug 8, 2020

    @mdempsky
    Contributor

    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.

  2. locked and limited conversation to collaborators on Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions