1// run
2
3// Copyright 2012 The Go Authors.  All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Issue 4167: inlining of a (*T).Method expression taking
8// its arguments from a multiple return breaks the compiler.
9
10package main
11
12type pa []int
13
14type p int
15
16func (this *pa) func1() (v *p, c int) {
17	for _ = range *this {
18		c++
19	}
20	v = (*p)(&c)
21	return
22}
23
24func (this *pa) func2() p {
25	return (*p).func3(this.func1())
26}
27
28func (this *p) func3(f int) p {
29	return *this
30}
31
32func (this *pa) func2dots() p {
33	return (*p).func3(this.func1())
34}
35
36func (this *p) func3dots(f ...int) p {
37	return *this
38}
39
40func main() {
41	arr := make(pa, 13)
42	length := arr.func2()
43	if int(length) != len(arr) {
44		panic("length != len(arr)")
45	}
46	length = arr.func2dots()
47	if int(length) != len(arr) {
48		panic("length != len(arr)")
49	}
50}
51