Commit a896869a authored by Alan Donovan's avatar Alan Donovan

go/types: unsafe.Pointer is not an alias

Change-Id: Ieb0808caa24c9a5e599084183ba5ee8a6536f7d8
Reviewed-on: https://go-review.googlesource.com/36622Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent d03c1248
......@@ -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")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment