1 |
700 |
jeremybenn |
// errchk $G -e $D/$F.go
|
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 |
|
|
|
9 |
|
|
type Tbyte []byte
|
10 |
|
|
type Trune []rune
|
11 |
|
|
type Tint64 []int64
|
12 |
|
|
type Tstring string
|
13 |
|
|
|
14 |
|
|
func main() {
|
15 |
|
|
s := "hello"
|
16 |
|
|
sb := []byte("hello")
|
17 |
|
|
sr := []rune("hello")
|
18 |
|
|
si := []int64{'h', 'e', 'l', 'l', 'o'}
|
19 |
|
|
|
20 |
|
|
ts := Tstring(s)
|
21 |
|
|
tsb := Tbyte(sb)
|
22 |
|
|
tsr := Trune(sr)
|
23 |
|
|
tsi := Tint64(si)
|
24 |
|
|
|
25 |
|
|
_ = string(s)
|
26 |
|
|
_ = []byte(s)
|
27 |
|
|
_ = []rune(s)
|
28 |
|
|
_ = []int64(s) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
29 |
|
|
_ = Tstring(s)
|
30 |
|
|
_ = Tbyte(s)
|
31 |
|
|
_ = Trune(s)
|
32 |
|
|
_ = Tint64(s) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
33 |
|
|
|
34 |
|
|
_ = string(sb)
|
35 |
|
|
_ = []byte(sb)
|
36 |
|
|
_ = []rune(sb) // ERROR "cannot convert.*\[\]rune|invalid type conversion"
|
37 |
|
|
_ = []int64(sb) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
38 |
|
|
_ = Tstring(sb)
|
39 |
|
|
_ = Tbyte(sb)
|
40 |
|
|
_ = Trune(sb) // ERROR "cannot convert.*Trune|invalid type conversion"
|
41 |
|
|
_ = Tint64(sb) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
42 |
|
|
|
43 |
|
|
_ = string(sr)
|
44 |
|
|
_ = []byte(sr) // ERROR "cannot convert.*\[\]byte|invalid type conversion"
|
45 |
|
|
_ = []rune(sr)
|
46 |
|
|
_ = []int64(sr) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
47 |
|
|
_ = Tstring(sr)
|
48 |
|
|
_ = Tbyte(sr) // ERROR "cannot convert.*Tbyte|invalid type conversion"
|
49 |
|
|
_ = Trune(sr)
|
50 |
|
|
_ = Tint64(sr) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
51 |
|
|
|
52 |
|
|
_ = string(si) // ERROR "cannot convert.* string|invalid type conversion"
|
53 |
|
|
_ = []byte(si) // ERROR "cannot convert.*\[\]byte|invalid type conversion"
|
54 |
|
|
_ = []rune(si) // ERROR "cannot convert.*\[\]rune|invalid type conversion"
|
55 |
|
|
_ = []int64(si)
|
56 |
|
|
_ = Tstring(si) // ERROR "cannot convert.*Tstring|invalid type conversion"
|
57 |
|
|
_ = Tbyte(si) // ERROR "cannot convert.*Tbyte|invalid type conversion"
|
58 |
|
|
_ = Trune(si) // ERROR "cannot convert.*Trune|invalid type conversion"
|
59 |
|
|
_ = Tint64(si)
|
60 |
|
|
|
61 |
|
|
_ = string(ts)
|
62 |
|
|
_ = []byte(ts)
|
63 |
|
|
_ = []rune(ts)
|
64 |
|
|
_ = []int64(ts) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
65 |
|
|
_ = Tstring(ts)
|
66 |
|
|
_ = Tbyte(ts)
|
67 |
|
|
_ = Trune(ts)
|
68 |
|
|
_ = Tint64(ts) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
69 |
|
|
|
70 |
|
|
_ = string(tsb)
|
71 |
|
|
_ = []byte(tsb)
|
72 |
|
|
_ = []rune(tsb) // ERROR "cannot convert.*\[\]rune|invalid type conversion"
|
73 |
|
|
_ = []int64(tsb) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
74 |
|
|
_ = Tstring(tsb)
|
75 |
|
|
_ = Tbyte(tsb)
|
76 |
|
|
_ = Trune(tsb) // ERROR "cannot convert.*Trune|invalid type conversion"
|
77 |
|
|
_ = Tint64(tsb) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
78 |
|
|
|
79 |
|
|
_ = string(tsr)
|
80 |
|
|
_ = []byte(tsr) // ERROR "cannot convert.*\[\]byte|invalid type conversion"
|
81 |
|
|
_ = []rune(tsr)
|
82 |
|
|
_ = []int64(tsr) // ERROR "cannot convert.*\[\]int64|invalid type conversion"
|
83 |
|
|
_ = Tstring(tsr)
|
84 |
|
|
_ = Tbyte(tsr) // ERROR "cannot convert.*Tbyte|invalid type conversion"
|
85 |
|
|
_ = Trune(tsr)
|
86 |
|
|
_ = Tint64(tsr) // ERROR "cannot convert.*Tint64|invalid type conversion"
|
87 |
|
|
|
88 |
|
|
_ = string(tsi) // ERROR "cannot convert.* string|invalid type conversion"
|
89 |
|
|
_ = []byte(tsi) // ERROR "cannot convert.*\[\]byte|invalid type conversion"
|
90 |
|
|
_ = []rune(tsi) // ERROR "cannot convert.*\[\]rune|invalid type conversion"
|
91 |
|
|
_ = []int64(tsi)
|
92 |
|
|
_ = Tstring(tsi) // ERROR "cannot convert.*Tstring|invalid type conversion"
|
93 |
|
|
_ = Tbyte(tsi) // ERROR "cannot convert.*Tbyte|invalid type conversion"
|
94 |
|
|
_ = Trune(tsi) // ERROR "cannot convert.*Trune|invalid type conversion"
|
95 |
|
|
_ = Tint64(tsi)
|
96 |
|
|
}
|