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 7package main 8 9type T int 10type U int 11 12var x int 13 14var 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" 18 19type S string 20var s S 21 22var s1 = s + "hello" 23var s2 = "hello" + s 24var s3 = s + string("hello") // ERROR "invalid operation|incompatible" 25var s4 = string("hello") + s // ERROR "invalid operation|incompatible" 26 27var r string 28 29var r1 = r + "hello" 30var r2 = "hello" + r 31var r3 = r + string("hello") 32var r4 = string("hello") + r 33 34