test: Match gccgo error messages.

bug284.go:33: error: invalid type conversion
bug284.go:36: error: invalid type conversion (cannot use type A2 as type A1)
bug284.go:37: error: invalid type conversion
bug284.go:38: error: invalid type conversion (cannot use type A1 as type A2)
bug284.go:56: error: invalid type conversion
bug284.go:59: error: invalid type conversion (cannot use type S2 as type S1)
bug284.go:60: error: invalid type conversion
bug284.go:61: error: invalid type conversion (cannot use type S1 as type S2)
bug284.go:71: error: invalid type conversion
bug284.go:74: error: invalid type conversion (cannot use type P2 as type P1)
bug284.go:75: error: invalid type conversion
bug284.go:76: error: invalid type conversion (cannot use type P1 as type P2)
bug284.go:96: error: invalid type conversion
bug284.go:99: error: invalid type conversion (cannot use type Q2 as type Q1)
bug284.go:101: error: invalid type conversion (cannot use type Q1 as type Q2)
bug284.go:111: error: invalid type conversion (different parameter types)
bug284.go:114: error: invalid type conversion (different parameter types)
bug284.go:115: error: invalid type conversion (different parameter types)
bug284.go:116: error: invalid type conversion (different parameter types)
bug284.go:134: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:137: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:138: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:139: error: invalid type conversion (incompatible type for method 'f' (different result types))
bug284.go:149: error: invalid type conversion
bug284.go:152: error: invalid type conversion (cannot use type L2 as type L1)
bug284.go:153: error: invalid type conversion
bug284.go:154: error: invalid type conversion (cannot use type L1 as type L2)
bug284.go:164: error: invalid type conversion
bug284.go:167: error: invalid type conversion (cannot use type L2 as type L1)
bug284.go:168: error: invalid type conversion
bug284.go:169: error: invalid type conversion (cannot use type L1 as type L2)
bug284.go:179: error: invalid type conversion
bug284.go:182: error: invalid type conversion (cannot use type C2 as type C1)
bug284.go:183: error: invalid type conversion
bug284.go:184: error: invalid type conversion (cannot use type C1 as type C2)

R=rsc
CC=golang-dev
https://golang.org/cl/2136041
This commit is contained in:
Ian Lance Taylor 2010-09-01 21:05:31 -07:00
parent c28525a137
commit 1331084c3d

View file

@ -30,12 +30,12 @@ func main() {
var a2 A2 var a2 A2
a0 = a0 a0 = a0
a0 = a1 a0 = a1
a0 = [3]int(a2) // ERROR "cannot" a0 = [3]int(a2) // ERROR "cannot|invalid"
a1 = a0 a1 = a0
a1 = a1 a1 = a1
a1 = A1(a2) // ERROR "cannot" a1 = A1(a2) // ERROR "cannot|invalid"
a2 = A2(a0) // ERROR "cannot" a2 = A2(a0) // ERROR "cannot|invalid"
a2 = A2(a1) // ERROR "cannot" a2 = A2(a1) // ERROR "cannot|invalid"
a2 = a2 a2 = a2
type S1 struct { type S1 struct {
@ -53,12 +53,12 @@ func main() {
s0 = s1 s0 = s1
s0 = struct { s0 = struct {
x int x int
}(s2) // ERROR "cannot" }(s2) // ERROR "cannot|invalid"
s1 = s0 s1 = s0
s1 = s1 s1 = s1
s1 = S1(s2) // ERROR "cannot" s1 = S1(s2) // ERROR "cannot|invalid"
s2 = S2(s0) // ERROR "cannot" s2 = S2(s0) // ERROR "cannot|invalid"
s2 = S2(s1) // ERROR "cannot" s2 = S2(s1) // ERROR "cannot|invalid"
s2 = s2 s2 = s2
type P1 *int type P1 *int
@ -68,12 +68,12 @@ func main() {
var p2 P2 var p2 P2
p0 = p0 p0 = p0
p0 = p1 p0 = p1
p0 = (*int)(p2) // ERROR "cannot" p0 = (*int)(p2) // ERROR "cannot|invalid"
p1 = p0 p1 = p0
p1 = p1 p1 = p1
p1 = P1(p2) // ERROR "cannot" p1 = P1(p2) // ERROR "cannot|invalid"
p2 = P2(p0) // ERROR "cannot" p2 = P2(p0) // ERROR "cannot|invalid"
p2 = P2(p1) // ERROR "cannot" p2 = P2(p1) // ERROR "cannot|invalid"
p2 = p2 p2 = p2
type Q1 *struct { type Q1 *struct {
@ -93,12 +93,12 @@ func main() {
})(ps1) // legal because of special conversion exception for pointers })(ps1) // legal because of special conversion exception for pointers
q0 = (*struct { q0 = (*struct {
x int x int
})(q2) // ERROR "cannot" })(q2) // ERROR "cannot|invalid"
q1 = q0 q1 = q0
q1 = q1 q1 = q1
q1 = Q1(q2) // ERROR "cannot" q1 = Q1(q2) // ERROR "cannot|invalid"
q2 = (*S1)(q0) // legal because of special conversion exception for pointers q2 = (*S1)(q0) // legal because of special conversion exception for pointers
q2 = Q2(q1) // ERROR "cannot" q2 = Q2(q1) // ERROR "cannot|invalid"
q2 = q2 q2 = q2
type F1 func(x NewInt) int type F1 func(x NewInt) int
@ -108,12 +108,12 @@ func main() {
var f2 F2 var f2 F2
f0 = f0 f0 = f0
f0 = f1 f0 = f1
f0 = func(x NewInt) int(f2) // ERROR "cannot" f0 = func(x NewInt) int(f2) // ERROR "cannot|invalid"
f1 = f0 f1 = f0
f1 = f1 f1 = f1
f1 = F1(f2) // ERROR "cannot" f1 = F1(f2) // ERROR "cannot|invalid"
f2 = F2(f0) // ERROR "cannot" f2 = F2(f0) // ERROR "cannot|invalid"
f2 = F2(f1) // ERROR "cannot" f2 = F2(f1) // ERROR "cannot|invalid"
f2 = f2 f2 = f2
type X1 interface { type X1 interface {
@ -131,12 +131,12 @@ func main() {
x0 = x1 x0 = x1
x0 = interface { x0 = interface {
f() int f() int
}(x2) // ERROR "cannot|need type assertion" }(x2) // ERROR "cannot|need type assertion|incompatible"
x1 = x0 x1 = x0
x1 = x1 x1 = x1
x1 = X1(x2) // ERROR "cannot|need type assertion" x1 = X1(x2) // ERROR "cannot|need type assertion|incompatible"
x2 = X2(x0) // ERROR "cannot|need type assertion" x2 = X2(x0) // ERROR "cannot|need type assertion|incompatible"
x2 = X2(x1) // ERROR "cannot|need type assertion" x2 = X2(x1) // ERROR "cannot|need type assertion|incompatible"
x2 = x2 x2 = x2
type L1 []int type L1 []int
@ -146,12 +146,12 @@ func main() {
var l2 L2 var l2 L2
l0 = l0 l0 = l0
l0 = l1 l0 = l1
l0 = []int(l2) // ERROR "cannot" l0 = []int(l2) // ERROR "cannot|invalid"
l1 = l0 l1 = l0
l1 = l1 l1 = l1
l1 = L1(l2) // ERROR "cannot" l1 = L1(l2) // ERROR "cannot|invalid"
l2 = L2(l0) // ERROR "cannot" l2 = L2(l0) // ERROR "cannot|invalid"
l2 = L2(l1) // ERROR "cannot" l2 = L2(l1) // ERROR "cannot|invalid"
l2 = l2 l2 = l2
type M1 map[string]int type M1 map[string]int
@ -161,12 +161,12 @@ func main() {
var m2 L2 var m2 L2
m0 = m0 m0 = m0
m0 = m1 m0 = m1
m0 = []int(m2) // ERROR "cannot" m0 = []int(m2) // ERROR "cannot|invalid"
m1 = m0 m1 = m0
m1 = m1 m1 = m1
m1 = L1(m2) // ERROR "cannot" m1 = L1(m2) // ERROR "cannot|invalid"
m2 = L2(m0) // ERROR "cannot" m2 = L2(m0) // ERROR "cannot|invalid"
m2 = L2(m1) // ERROR "cannot" m2 = L2(m1) // ERROR "cannot|invalid"
m2 = m2 m2 = m2
type C1 chan int type C1 chan int
@ -176,12 +176,12 @@ func main() {
var c2 C2 var c2 C2
c0 = c0 c0 = c0
c0 = c1 c0 = c1
c0 = chan int(c2) // ERROR "cannot" c0 = chan int(c2) // ERROR "cannot|invalid"
c1 = c0 c1 = c0
c1 = c1 c1 = c1
c1 = C1(c2) // ERROR "cannot" c1 = C1(c2) // ERROR "cannot|invalid"
c2 = C2(c0) // ERROR "cannot" c2 = C2(c0) // ERROR "cannot|invalid"
c2 = C2(c1) // ERROR "cannot" c2 = C2(c1) // ERROR "cannot|invalid"
c2 = c2 c2 = c2
// internal compiler error (6g and gccgo) // internal compiler error (6g and gccgo)