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:
parent
b47dfd93e5
commit
35b3d645bc
@ -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)
|
||||
}
|
||||
|
1
oracle/testdata/src/describe/main.go
vendored
1
oracle/testdata/src/describe/main.go
vendored
@ -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
|
||||
|
7
oracle/testdata/src/describe/main.golden
vendored
7
oracle/testdata/src/describe/main.golden
vendored
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user