1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package issue12839 is a go/doc test to test association of a function
6// that returns multiple types.
7// See golang.org/issue/12839.
8// (See also golang.org/issue/27928.)
9package issue12839
10
11import "p"
12
13type T1 struct{}
14
15type T2 struct{}
16
17func (t T1) hello() string {
18	return "hello"
19}
20
21// F1 should not be associated with T1
22func F1() (*T1, *T2) {
23	return &T1{}, &T2{}
24}
25
26// F2 should be associated with T1
27func F2() (a, b, c T1) {
28	return T1{}, T1{}, T1{}
29}
30
31// F3 should be associated with T1 because b.T3 is from a different package
32func F3() (a T1, b p.T3) {
33	return T1{}, p.T3{}
34}
35
36// F4 should not be associated with a type (same as F1)
37func F4() (a T1, b T2) {
38	return T1{}, T2{}
39}
40
41// F5 should be associated with T1.
42func F5() (T1, error) {
43	return T1{}, nil
44}
45
46// F6 should be associated with T1.
47func F6() (*T1, error) {
48	return &T1{}, nil
49}
50
51// F7 should be associated with T1.
52func F7() (T1, string) {
53	return T1{}, nil
54}
55
56// F8 should be associated with T1.
57func F8() (int, T1, string) {
58	return 0, T1{}, nil
59}
60
61// F9 should not be associated with T1.
62func F9() (int, T1, T2) {
63	return 0, T1{}, T2{}
64}
65
66// F10 should not be associated with T1.
67func F10() (T1, T2, error) {
68	return T1{}, T2{}, nil
69}
70