Russ Cox | d2cc988 | 2012-02-16 23:50:37 -0500 | [diff] [blame] | 1 | // errorcheck |
Russ Cox | 5ed04d7 | 2008-09-30 14:08:43 -0700 | [diff] [blame] | 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 | |
Rob Pike | 83976e3 | 2012-02-19 14:28:53 +1100 | [diff] [blame] | 7 | // Verify that illegal function signatures are detected. |
| 8 | // Does not compile. |
| 9 | |
Russ Cox | 5ed04d7 | 2008-09-30 14:08:43 -0700 | [diff] [blame] | 10 | package main |
| 11 | |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 12 | type t1 int |
| 13 | type t2 int |
| 14 | type t3 int |
Russ Cox | 5ed04d7 | 2008-09-30 14:08:43 -0700 | [diff] [blame] | 15 | |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 16 | func f1(*t2, x t3) // ERROR "named" |
| 17 | func f2(t1, *t2, x t3) // ERROR "named" |
| 18 | func f3() (x int, *string) // ERROR "named" |
Russ Cox | 5ed04d7 | 2008-09-30 14:08:43 -0700 | [diff] [blame] | 19 | |
Rob Pike | 4f61fc9 | 2010-09-04 10:36:13 +1000 | [diff] [blame] | 20 | func f4() (t1 t1) // legal - scope of parameter named t1 starts in body of f4. |