blob: c205c5bcaacb3c0f725969d7243d04c64519e64f [file] [log] [blame]
Russ Cox14be7332009-08-24 13:41:47 -07001// errchk $G $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
7package main
8
9type T int
10type U int
11
12var x int
13
Ian Lance Taylor1a051772009-08-31 21:39:08 -070014var t T = int(0) // ERROR "cannot use|incompatible"
15var t1 T = int(x) // ERROR "cannot use|incompatible"
16var u U = int(0) // ERROR "cannot use|incompatible"
17var u1 U = int(x) // ERROR "cannot use|incompatible"
Russ Cox14be7332009-08-24 13:41:47 -070018
19type S string
20var s S
21
22var s1 = s + "hello"
23var s2 = "hello" + s
Ian Lance Taylor1a051772009-08-31 21:39:08 -070024var s3 = s + string("hello") // ERROR "invalid operation|incompatible"
25var s4 = string("hello") + s // ERROR "invalid operation|incompatible"
Russ Cox14be7332009-08-24 13:41:47 -070026
27var r string
28
29var r1 = r + "hello"
30var r2 = "hello" + r
31var r3 = r + string("hello")
32var r4 = string("hello") + r
33