Rémy Oudompheng | 2ece2f5 | 2012-02-18 22:15:42 +0100 | [diff] [blame] | 1 | // run |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 2 | |
| 3 | // Copyright 2011 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 | |
| 7 | package main |
| 8 | |
Russ Cox | 44526cd | 2011-11-01 22:06:05 -0400 | [diff] [blame] | 9 | import "io" |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 10 | |
Russ Cox | 44526cd | 2011-11-01 22:06:05 -0400 | [diff] [blame] | 11 | func f() (_ string, x float64, err error) { |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 12 | return |
| 13 | } |
| 14 | |
Russ Cox | 44526cd | 2011-11-01 22:06:05 -0400 | [diff] [blame] | 15 | func g() (_ string, x float64, err error) { |
| 16 | return "hello", 3.14, io.EOF |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 17 | } |
| 18 | |
Russ Cox | 44526cd | 2011-11-01 22:06:05 -0400 | [diff] [blame] | 19 | var _ func() (string, float64, error) = f |
| 20 | var _ func() (string, float64, error) = g |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 21 | |
| 22 | func main() { |
| 23 | x, y, z := g() |
Russ Cox | 44526cd | 2011-11-01 22:06:05 -0400 | [diff] [blame] | 24 | if x != "hello" || y != 3.14 || z != io.EOF { |
Russ Cox | 815a1b8 | 2011-04-23 10:54:19 -0400 | [diff] [blame] | 25 | println("wrong", x, len(x), y, z) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | /* |
| 30 | issue 1712 |
| 31 | |
| 32 | bug331.go:12: cannot use "hello" (type string) as type float64 in assignment |
| 33 | bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment: |
| 34 | float64 does not implement os.Error (missing String method) |
| 35 | bug331.go:12: error in shape across RETURN |
| 36 | */ |