if HaveInlineBody(methNode.Func) {
// Export the body as well if
// instantiation is inlineable.
+ ImportedBody(methNode.Func)
methNode.Func.SetExportInline(true)
}
}
--- /dev/null
+// 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 a0
+
+type Builder[T any] struct{}
+
+func (r Builder[T]) New1() T {
+ var v T
+ return v
+}
+
+func (r Builder[T]) New2() T {
+ var v T
+ return v
+}
+
+type IntBuilder struct{}
+
+func (b IntBuilder) New() int {
+ return Builder[int]{}.New2()
+}
--- /dev/null
+// 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 a1
+
+import "a0"
+
+func New() int {
+ return a0.IntBuilder{}.New()
+}
--- /dev/null
+// 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 a2
+
+import "a0"
+
+func New() int {
+ return a0.Builder[int]{}.New1()
+}
--- /dev/null
+// 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
+
+import (
+ "fmt"
+
+ "a1"
+ "a2"
+)
+
+func New() int {
+ return a1.New() + a2.New()
+}
+
+func main() {
+ if got, want := New(), 0; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+}
--- /dev/null
+// rundir -G=3
+
+// 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 ignored