1
0
mirror of https://github.com/golang/go synced 2024-11-21 16:54:46 -07:00

test: match gccgo error messages

bug363.go:13:12: error: invalid context-determined non-integer type for shift operand
bug363.go:16:12: error: invalid context-determined non-integer type for shift operand

pointer.go:34:6: error: incompatible type in initialization (pointer to interface type has no methods)
pointer.go:36:6: error: incompatible type in initialization

method2.go:15:1: error: invalid pointer or interface receiver type
method2.go:16:1: error: invalid pointer or interface receiver type
method2.go:21:1: error: invalid pointer or interface receiver type
method2.go:22:1: error: invalid pointer or interface receiver type
method2.go:28:15: error: type ‘*Val’ has no method ‘val’
method2.go:33:11: error: reference to undefined field or method ‘val’

shift1.go:19:16: error: invalid context-determined non-integer type for shift operand
shift1.go:24:19: error: invalid context-determined non-integer type for shift operand
shift1.go:25:17: error: invalid context-determined non-integer type for shift operand
shift1.go:18:18: error: shift of non-integer operand
shift1.go:26:13: error: floating point constant truncated to integer
shift1.go:33:15: error: integer constant overflow
shift1.go:34:15: error: integer constant overflow
shift1.go:35:17: error: integer constant overflow

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5081051
This commit is contained in:
Ian Lance Taylor 2011-09-21 17:25:48 -07:00
parent ec8469b6c7
commit 9169c27eaa
4 changed files with 11 additions and 11 deletions

View File

@ -10,10 +10,10 @@ package main
func main() {
var i uint = 33
var a = (1<<i) + 4.5 // ERROR "shift of type float64|shift of non-integer"
var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift"
println(a)
var b = (1<<i) + 4.0 // ERROR "shift of type float64|shift of non-integer"
var b = (1<<i) + 4.0 // ERROR "shift of type float64|invalid.*shift"
println(b)
var c int64 = (1<<i) + 4.0 // ok - it's all int64

View File

@ -33,5 +33,5 @@ func main() {
print("call addinst\n")
var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
print("return from addinst\n")
var y *Inst = new(Start) // ERROR "pointer to interface"
var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type"
}

View File

@ -12,14 +12,14 @@ type T struct {
type P *T
type P1 *T
func (p P) val() int { return 1 } // ERROR "receiver.* pointer"
func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer"
func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
type I interface{}
type I1 interface{}
func (p I) val() int { return 1 } // ERROR "receiver.*interface"
func (p *I1) val() int { return 1 } // ERROR "receiver.*interface"
func (p I) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
func (p *I1) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
type Val interface {
val() int

View File

@ -15,14 +15,14 @@ func h(x float64) int { return 0 }
// from the spec
var (
s uint = 33
u = 1.0 << s // ERROR "invalid operation"
v float32 = 1 << s // ERROR "invalid operation" "as type float32"
u = 1.0 << s // ERROR "invalid operation|shift of non-integer operand"
v float32 = 1 << s // ERROR "invalid" "as type float32"
)
// non-constant shift expressions
var (
e1 = g(2.0 << s) // ERROR "invalid operation" "as type interface"
f1 = h(2 << s) // ERROR "invalid operation" "as type float64"
e1 = g(2.0 << s) // ERROR "invalid" "as type interface"
f1 = h(2 << s) // ERROR "invalid" "as type float64"
g1 int64 = 1.1 << s // ERROR "truncated"
)