From ac39dbdf58e50a2575b891675e7d2e1400b20cfe Mon Sep 17 00:00:00 2001 From: Wayne Zuo Date: Thu, 5 May 2022 21:46:51 +0800 Subject: 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 Reviewed-by: Cuong Manh Le TryBot-Result: Gopher Robot Reviewed-by: David Chase Reviewed-by: Matthew Dempsky --- test/typeparam/issue52241.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/typeparam/issue52241.go (limited to 'test/typeparam') diff --git a/test/typeparam/issue52241.go b/test/typeparam/issue52241.go new file mode 100644 index 0000000000..4feb97e013 --- /dev/null +++ b/test/typeparam/issue52241.go @@ -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() +} -- cgit v1.3-5-g45d5