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. 4 5// Test method expressions with arguments. 6 7package method4a 8 9type T1 int 10 11type T2 struct { 12 F int 13} 14 15type I1 interface { 16 Sum([]int, int) int 17} 18 19type I2 interface { 20 Sum(a []int, b int) int 21} 22 23func (i T1) Sum(a []int, b int) int { 24 r := int(i) + b 25 for _, v := range a { 26 r += v 27 } 28 return r 29} 30 31func (p *T2) Sum(a []int, b int) int { 32 r := p.F + b 33 for _, v := range a { 34 r += v 35 } 36 return r 37} 38