-// errchk $G -e $F.go
+// errorcheck
// Copyright 2009 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.
-// Incorrect short declarations and redeclarations.
+// Test that incorrect short declarations and redeclarations are detected.
+// Does not compile.
package main
_, _, _ = i, f, s
}
{
+ // multiline no new variables
+ i := f1
+ i := func() { // ERROR "redeclared|no new|incompatible"
+ }
+ _ = i
+ }
+ {
// single redeclaration
i, f, s := f3()
i := 1 // ERROR "redeclared|no new|incompatible"