Russ Cox | d5269d0 | 2009-05-21 14:46:13 -0700 | [diff] [blame] | 1 | // errchk $G -e $D/$F.go |
| 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 | |
| 7 | package main |
| 8 | |
| 9 | type S struct { |
| 10 | A, B, C, X, Y, Z int; |
| 11 | } |
| 12 | |
| 13 | type T struct { |
| 14 | S; |
| 15 | } |
| 16 | |
| 17 | var x = 1 |
Ian Lance Taylor | 8cbb5d0 | 2009-05-31 11:18:52 -0700 | [diff] [blame] | 18 | var a1 = S { 0, X: 1 }; // ERROR "mixture|undefined" |
Russ Cox | d5269d0 | 2009-05-21 14:46:13 -0700 | [diff] [blame] | 19 | var a2 = S { Y: 3, Z: 2, Y: 3 }; // ERROR "duplicate" |
Ian Lance Taylor | 8cbb5d0 | 2009-05-31 11:18:52 -0700 | [diff] [blame] | 20 | var a3 = T { 1, 2, 3, 4, 5, 6 }; // ERROR "convert|too many" |
| 21 | var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index|too many" |
Russ Cox | d5269d0 | 2009-05-21 14:46:13 -0700 | [diff] [blame] | 22 | var a5 = []byte { x: 2 } // ERROR "index" |
| 23 | |
| 24 | var ok1 = S { } // should be ok |
Russ Cox | c2fa45b | 2009-05-21 16:31:10 -0700 | [diff] [blame] | 25 | var ok2 = T { S: ok1 } // should be ok |