// but bitwise inverted so we can detect if we're missing the entry
// or not.
newindex []index
+
+ // indicates whether the data is reading during reshaping.
+ reshaping bool
}
func newPkgReader(pr pkgbits.PkgDecoder) *pkgReader {
// find parameters/results.
funarghack bool
+ // reshaping is used during reading exprReshape code, preventing
+ // the reader from shapifying the re-shaped type.
+ reshaping bool
+
// methodSym is the name of method's name, if reading a method.
// It's nil if reading a normal function or closure body.
methodSym *types.Sym
// arguments.
for i, targ := range dict.targs {
basic := r.Bool()
- if dict.shaped {
+ if dict.shaped && !pr.reshaping {
dict.targs[i] = shapify(targ, basic)
}
}
case exprReshape:
typ := r.typ()
+ old := r.reshaping
+ r.reshaping = true
x := r.expr()
+ r.reshaping = old
if types.IdenticalStrict(x.Type(), typ) {
return x
info := r.dict.subdicts[idx]
explicits := r.p.typListIdx(info.explicits, r.dict)
+ old := r.p.reshaping
+ r.p.reshaping = r.reshaping
baseFn = r.p.objIdx(info.idx, implicits, explicits, true).(*ir.Name)
+ r.p.reshaping = old
// TODO(mdempsky): Is there a more robust way to get the
// dictionary pointer type here?
--- /dev/null
+// compile
+
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package x
+
+func F[T int32]() {
+ _ = G[*[0]T]()[:]
+}
+
+func G[T any]() (v T) {
+ return
+}
+
+var _ = F[int32]