reflect: fix Type.Name to return empty string for non-named types

// Name returns the type's name within its package for a defined type.
    // For other (non-defined) types it returns the empty string.
This commit is contained in:
Damian Gryski
2023-03-15 12:24:36 -07:00
committed by Damian Gryski
parent c6728643e6
commit 9f02340a26
+5 -1
View File
@@ -923,7 +923,11 @@ func (t *rawType) Name() string {
return readStringZ(unsafe.Pointer(&ntype.name[0]))
}
return t.Kind().String()
if t.Kind() <= UnsafePointer {
return t.Kind().String()
}
return ""
}
func (t *rawType) Key() Type {