// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // statements package stmt0 func assignments0() (int, int) { var a, b, c int var ch chan int f0 := func() {} f1 := func() int { return 1 } f2 := func() (int, int) { return 1, 2 } f3 := func() (int, int, int) { return 1, 2, 3 } a, b, c = 1, 2, 3 a, b, c = 1 /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ , 2 a, b, c = 1 /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ , 2, 3, 4 _, _, _ = a, b, c a = f0 /* ERROR "used as value" */ () a = f1() a = f2 /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ () a, b = f2() a, b, c = f2 /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ () a, b, c = f3() a, b = f3 /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ () a, b, c = <- /* ERROR "cannot assign [1-9]+ values to [1-9]+ variables" */ ch return /* ERROR "wrong number of return values" */ return /* ERROR "wrong number of return values" */ 1 return 1, 2 return /* ERROR "wrong number of return values" */ 1, 2, 3 } func assignments1() { b, i, f, c, s := false, 1, 1.0, 1i, "foo" b = i /* ERROR "cannot use .* in assignment" */ i = f /* ERROR "cannot use .* in assignment" */ f = c /* ERROR "cannot use .* in assignment" */ c = s /* ERROR "cannot use .* in assignment" */ s = b /* ERROR "cannot use .* in assignment" */ v0, v1, v2 := 1 /* ERROR "cannot initialize" */ , 2, 3, 4 _, _, _ = v0, v1, v2 b = true i += 1 i += "foo" /* ERROR "mismatched types int and untyped string" */ f -= 1 f /= 0 f = float32(0)/0 /* ERROR "division by zero" */ f -= "foo" /* ERROR "mismatched types float64 and untyped string" */ c *= 1 c /= 0 s += "bar" s += 1 /* ERROR "mismatched types string and untyped int" */ var u64 uint64 u64 += 1<