]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/reflectdata/reflect.go
[dev.typeparams] all: merge master (f22ec51) into dev.typeparams
[gostls13.git] / src / cmd / compile / internal / reflectdata / reflect.go
index b3688fca673b29ab9436529ed14c4f50398c1c2e..3576a23db9f34f07c57acec1cfd4af698bdfb936 100644 (file)
@@ -951,8 +951,12 @@ func writeType(t *types.Type) *obj.LSym {
        }
 
        if base.Ctxt.Pkgpath != "runtime" || (tbase != types.Types[tbase.Kind()] && tbase != types.ByteType && tbase != types.RuneType && tbase != types.ErrorType) { // int, float, etc
-               // named types from other files are defined only by those files
-               if tbase.Sym() != nil && tbase.Sym().Pkg != types.LocalPkg {
+               // Named types from other files are defined only by those files.
+               // However, as an exception, we can write out instantiated types
+               // in the local package, even if they may be marked as part of
+               // another package (the package of their base generic type).
+               if tbase.Sym() != nil && tbase.Sym().Pkg != types.LocalPkg &&
+                       len(tbase.RParams()) == 0 {
                        if i := typecheck.BaseTypeIndex(t); i >= 0 {
                                lsym.Pkg = tbase.Sym().Pkg.Prefix
                                lsym.SymIdx = int32(i)