LoongArch: Organize the code related to split move and merge the same functions.
[official-gcc.git] / gcc / testsuite / go.test / test / method3.go
blobfd64771527ed07cefb3359189f6ba900193e6842
1 // run
3 // Copyright 2009 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.
7 // Test methods on slices.
9 package main
11 type T []int
13 func (t T) Len() int { return len(t) }
15 type I interface {
16 Len() int
19 func main() {
20 var t T = T{0, 1, 2, 3, 4}
21 var i I
22 i = t
23 if i.Len() != 5 {
24 println("i.Len", i.Len())
25 panic("fail")
27 if T.Len(t) != 5 {
28 println("T.Len", T.Len(t))
29 panic("fail")
31 if (*T).Len(&t) != 5 {
32 println("(*T).Len", (*T).Len(&t))
33 panic("fail")