aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go4
-rw-r--r--src/reflect/type.go3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 2849d4ee40..15173c54dc 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -717,6 +717,10 @@ func writeType(t *types.Type) *obj.LSym {
}
s.SetSiggen(true)
+ if !tbase.HasShape() {
+ TypeLinksym(t) // ensure lsym.Extra is set
+ }
+
if !NeedEmit(tbase) {
if i := typecheck.BaseTypeIndex(t); i >= 0 {
lsym.Pkg = tbase.Sym().Pkg.Prefix
diff --git a/src/reflect/type.go b/src/reflect/type.go
index cec8662c01..fc6edb1e10 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -1314,7 +1314,8 @@ func TypeOf(i any) Type {
// TypeFor returns the [Type] that represents the type argument T.
func TypeFor[T any]() Type {
- return toType(abi.TypeFor[T]())
+ // toRType is safe to use here; type is never nil as T is statically known.
+ return toRType(abi.TypeFor[T]())
}
// rtypeOf directly extracts the *rtype of the provided value.