diff options
author | Ayke van Laethem <[email protected]> | 2024-07-28 19:00:00 +0200 |
---|---|---|
committer | Ayke <[email protected]> | 2024-07-31 21:08:23 +0200 |
commit | 88f9fc3ce2802c8d79bb8205ef5d6a1be5391186 (patch) | |
tree | dc859a710b5e3d1640b77b92fe954047caeebb56 /src/reflect | |
parent | 84c376160f7a127d1beecf3f09f0f8e5caff641c (diff) | |
download | tinygo-88f9fc3ce2802c8d79bb8205ef5d6a1be5391186.tar.gz tinygo-88f9fc3ce2802c8d79bb8205ef5d6a1be5391186.zip |
reflect: return correct name for unsafe.Pointer type
For some reason, the type kind name is "unsafe.Pointer" while the
.Name() method just returns "Pointer".
Not sure why this difference exists, but to be able to test .Name() in
testdata/reflect.go it needs to match.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/type.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reflect/type.go b/src/reflect/type.go index 1356f67cd..1ac509cbb 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -1060,8 +1060,10 @@ func (t *rawType) Name() string { panic("corrupt name data") } - if t.Kind() <= UnsafePointer { + if kind := t.Kind(); kind < UnsafePointer { return t.Kind().String() + } else if kind == UnsafePointer { + return "Pointer" } return "" |