1// run
2
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.
6
7package main
8
9import "fmt"
10
11type Buffer int
12
13func (*Buffer) Read() {}
14
15type Reader interface {
16	Read()
17}
18
19func f() *Buffer { return nil }
20
21func g() Reader {
22	// implicit interface conversion in assignment during return
23	return f()
24}
25
26func h() (b *Buffer, ok bool) { return }
27
28func i() (r Reader, ok bool) {
29	// implicit interface conversion in multi-assignment during return
30	return h()
31}
32
33func fmter() (s string, i int, t string) { return "%#x %q", 100, "hello" }
34
35func main() {
36	b := g()
37	bb, ok := b.(*Buffer)
38	_, _, _ = b, bb, ok
39
40	b, ok = i()
41	bb, ok = b.(*Buffer)
42	_, _, _ = b, bb, ok
43
44	s := fmt.Sprintf(fmter())
45	if s != "0x64 \"hello\"" {
46		println(s)
47		panic("fail")
48	}
49}
50