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)
85 mt2 := &method4a.T2{4}
87 eq(mt1.Sum(a, 30), 40)
88 eq(mt2.Sum(a, 31), 41)
90 eq(method4a.T1.Sum(mt1, a, 32), 42)
91 eq((*method4a.T2).Sum(mt2, a, 33), 43)
94 eq(g1(mt1, a, 34), 44)
95 g2 := (*method4a.T2).Sum
96 eq(g2(mt2, a, 35), 45)
98 eq(method4a.I1.Sum(mt1, a, 36), 46)
99 eq(method4a.I1.Sum(mt2, a, 37), 47)
101 g3 := method4a.I1.Sum
102 eq(g3(mt1, a, 38), 48)
103 eq(g3(mt2, a, 39), 49)
105 eq(method4a.I2.Sum(mt1, a, 40), 50)
106 eq(method4a.I2.Sum(mt2, a, 41), 51)
108 g4 := method4a.I2.Sum
109 eq(g4(mt1, a, 42), 52)
110 eq(g4(mt2, a, 43), 53)