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.
7 // Test conversion from non-interface types to the empty interface.
30 func (U16) Method() {}
31 func (U32) Method() {}
32 func (U64) Method() {}
33 func (U128) Method() {}
34 func (F32) Method() {}
35 func (F64) Method() {}
36 func (C128) Method() {}
61 iu16 interface{} = u16
62 iu32 interface{} = u32
63 iu64 interface{} = u64
64 iu128 interface{} = u128
65 if32 interface{} = f32
66 if64 interface{} = f64
67 ic128 interface{} = c128
88 jp J = p // The method set for *T contains the methods for T.
89 // pp does not implement error.
92 func second(a ...interface{}) interface{} {
117 panic("u128 != iu128")
120 panic("u128 != ju128")
135 panic("c128 != ic128")
138 panic("c128 != jc128")
152 // There are no tests for b and m, as slices and maps are not comparable by ==.
168 // pp does not implement J.
170 // Test that non-interface types can be used as ...interface{} arguments.
171 if got := second(z, p, pp, u16, u32, u64, u128, f32, f64, c128, s, b, m, c); got != ip {
172 println("second: got", got, "want", ip)
176 // Test that non-interface types can be sent on a chan interface{}.
178 uc := make(chan interface{})
180 for i := 0; i < n; i++ {
189 for i := 0; i < n; i++ {
190 if got := <-uc; got != nil && got != u32 && got != u64 && got != u128 {
191 println("recv: i", i, "got", got)