1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00

oracle: fix panic when describing "unsafe"

Fixes issue 14160

Change-Id: Ie27d79ba135cadd2e6f5d3b40b8eca25b6a030d9
Reviewed-on: https://go-review.googlesource.com/19158
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Alan Donovan 2016-02-02 16:27:46 -05:00
parent b47dfd93e5
commit 35b3d645bc
3 changed files with 14 additions and 0 deletions

View File

@ -680,6 +680,12 @@ func tokenOf(o types.Object) string {
return "const"
case *types.PkgName:
return "package"
case *types.Builtin:
return "builtin" // e.g. when describing package "unsafe"
case *types.Nil:
return "nil"
case *types.Label:
return "label"
}
panic(o)
}

View File

@ -9,6 +9,7 @@ package describe // @describe pkgdecl "describe"
import (
"nosuchpkg" // @describe badimport1 "nosuchpkg"
nosuchpkg2 "nosuchpkg" // @describe badimport2 "nosuchpkg2"
_ "unsafe" // @describe unsafe "unsafe"
)
var _ nosuchpkg.T

View File

@ -19,6 +19,13 @@ Error: can't import package "nosuchpkg"
-------- @describe badimport2 --------
Error: can't import package "nosuchpkg"
-------- @describe unsafe --------
import of package "unsafe"
builtin Alignof
builtin Offsetof
type Pointer unsafe.Pointer
builtin Sizeof
-------- @describe type-ref-builtin --------
reference to built-in type float64