1
// Copyright 2012 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.
5
// Test method expressions with arguments.
22
Sum(a []int, b int) int
25
func (i T1) Sum(a []int, b int) int {
33
func (p *T2) Sum(a []int, b int) int {
55
eq(T1.Sum(t1, a, 7), 17)
56
eq((*T2).Sum(t2, a, 8), 18)
63
eq(I1.Sum(t1, a, 11), 21)
64
eq(I1.Sum(t2, a, 12), 22)
70
eq(I2.Sum(t1, a, 15), 25)
71
eq(I2.Sum(t2, a, 16), 26)
78
mt2 := &method4a.T2{4}
80
eq(mt1.Sum(a, 30), 40)
81
eq(mt2.Sum(a, 31), 41)
83
eq(method4a.T1.Sum(mt1, a, 32), 42)
84
eq((*method4a.T2).Sum(mt2, a, 33), 43)
87
eq(g1(mt1, a, 34), 44)
88
g2 := (*method4a.T2).Sum
89
eq(g2(mt2, a, 35), 45)
91
eq(method4a.I1.Sum(mt1, a, 36), 46)
92
eq(method4a.I1.Sum(mt2, a, 37), 47)
95
eq(g3(mt1, a, 38), 48)
96
eq(g3(mt2, a, 39), 49)
98
eq(method4a.I2.Sum(mt1, a, 40), 50)
99
eq(method4a.I2.Sum(mt2, a, 41), 51)
101
g4 := method4a.I2.Sum
102
eq(g4(mt1, a, 42), 52)
103
eq(g4(mt2, a, 43), 53)