Debian Codegraph @

test/fixedbugs/bug197.go

raw
1 // errorcheck
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 T int
10 type U int
11
12 var x int
13
14 var t T = int(0) // ERROR "cannot use|incompatible"
15 var t1 T = int(x) // ERROR "cannot use|incompatible"
16 var u U = int(0) // ERROR "cannot use|incompatible"
17 var u1 U = int(x) // ERROR "cannot use|incompatible"
18
19 type S string
20 var s S
21
22 var s1 = s + "hello"
23 var s2 = "hello" + s
24 var s3 = s + string("hello") // ERROR "invalid operation|incompatible"
25 var s4 = string("hello") + s // ERROR "invalid operation|incompatible"
26
27 var r string
28
29 var r1 = r + "hello"
30 var r2 = "hello" + r
31 var r3 = r + string("hello")
32 var r4 = string("hello") + r
33