Skip to content

Meaningless error message (related to type assertion at global scope) #915

@nsf

Description

@nsf
Code:
-------------------------------------------------------------
package main

type MyInterface interface {
}

type My struct {
    a, b, c int
}

var my = &My{1,2,3}
var myInterface MyInterface = my
var origMy, ok = myInterface.(*My)

func main() {
}
-------------------------------------------------------------

Compilation gives:
-------------------------------------------------------------
[nsf @ waytogo]$ 8g test.go
defn [9f9cbc0]
.   AS2DOTTYPE l(12) x(-1000000000) tc(1)
.   AS2DOTTYPE-list
.   .   NAME-origMy G0 u(1) a(1) l(12) class(1) tc(1) *My
.   .   NAME-ok G0 u(1) a(1) l(12) class(1) tc(1) bool
.   AS2DOTTYPE-rlist
.   .   DOTTYPE2 l(12) x(-1000000000) tc(1) *My
.   .   .   NAME-myInterface G0 u(1) a(1) l(11) class(1) tc(1) MyInterface
test.go:15: internal compiler error: init1: bad defn
-------------------------------------------------------------

Compiler/machine spec:
linux, 386, b761e0299e9b release/release.2010-07-01

Even if it's not a legal declaration, good error message is expected.

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