mirror of
https://github.com/golang/go
synced 2024-10-01 13:44:47 +00:00
cmd/compile: allow exporting .rcvr
ident
Noder pass will build a closure to implement generic function instantiation which may produce `.dict` and `.rcvr` ident. Since we allow `.dict` during exporting, we should allow `.rcvr` too. Fixes #52241. Change-Id: Ifc3912ba5155b5ac1887f20830da64f4fb3fceb6 Reviewed-on: https://go-review.googlesource.com/c/go/+/404314 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
12420f9c01
commit
ac39dbdf58
|
@ -2188,7 +2188,7 @@ func (w *exportWriter) localIdent(s *types.Sym) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if i := strings.LastIndex(name, "."); i >= 0 && !strings.HasPrefix(name, LocalDictName) {
|
if i := strings.LastIndex(name, "."); i >= 0 && !strings.HasPrefix(name, LocalDictName) && !strings.HasPrefix(name, ".rcvr") {
|
||||||
base.Fatalf("unexpected dot in identifier: %v", name)
|
base.Fatalf("unexpected dot in identifier: %v", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
test/typeparam/issue52241.go
Normal file
22
test/typeparam/issue52241.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// compile
|
||||||
|
|
||||||
|
// Copyright 2022 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 main
|
||||||
|
|
||||||
|
type Collector[T any] struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Collector[T]) Collect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestInOrderIntTree() {
|
||||||
|
collector := Collector[int]{}
|
||||||
|
_ = collector.Collect
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
TestInOrderIntTree()
|
||||||
|
}
|
Loading…
Reference in a new issue