mirror of https://github.com/golang/go.git
go/types: unsafe.Pointer is not an alias
Change-Id: Ieb0808caa24c9a5e599084183ba5ee8a6536f7d8 Reviewed-on: https://go-review.googlesource.com/36622 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
d03c124860
commit
a896869a49
|
|
@ -164,6 +164,10 @@ func (obj *TypeName) IsAlias() bool {
|
|||
case nil:
|
||||
return false
|
||||
case *Basic:
|
||||
// unsafe.Pointer is not an alias.
|
||||
if obj.pkg == Unsafe {
|
||||
return false
|
||||
}
|
||||
// Any user-defined type name for a basic type is an alias for a
|
||||
// basic type (because basic types are pre-declared in the Universe
|
||||
// scope, outside any package scope), and so is any type name with
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ func TestIsAlias(t *testing.T) {
|
|||
}
|
||||
|
||||
// predeclared types
|
||||
check(Unsafe.Scope().Lookup("Pointer").(*TypeName), false)
|
||||
for _, name := range Universe.Names() {
|
||||
if obj, _ := Universe.Lookup(name).(*TypeName); obj != nil {
|
||||
check(obj, name == "byte" || name == "rune")
|
||||
|
|
|
|||
Loading…
Reference in New Issue