// declaration itself. So if there are no cases, we won't
// notice that it went unused.
if v := n.Left.Left; v != nil && !v.isBlank() && n.List.Len() == 0 {
- yyerrorl(v.Pos, "%v declared and not used", v.Sym)
+ yyerrorl(v.Pos, "%v declared but not used", v.Sym)
}
var defCase, nilCase *Node
if defn.Left.Name.Used() {
continue
}
- yyerrorl(defn.Left.Pos, "%v declared and not used", ln.Sym)
+ yyerrorl(defn.Left.Pos, "%v declared but not used", ln.Sym)
defn.Left.Name.SetUsed(true) // suppress repeats
} else {
- yyerrorl(ln.Pos, "%v declared and not used", ln.Sym)
+ yyerrorl(ln.Pos, "%v declared but not used", ln.Sym)
}
}
package foo
func f(x interface{}) {
- switch t := x.(type) { // ERROR "declared and not used"
+ switch t := x.(type) { // ERROR "declared but not used"
case int:
}
}
log.Fatalf("expected cmd/compile to fail")
}
wantErrs := []string{
- "7:9: n declared and not used",
- "7:12: err declared and not used",
+ "7:9: n declared but not used",
+ "7:12: err declared but not used",
}
outStr := string(out)
for _, want := range wantErrs {
switch x.(type) {
}
- switch t := x.(type) { // ERROR "declared and not used"
+ switch t := x.(type) { // ERROR "declared but not used"
}
}
package main
func _() {
- x := 7 // ERROR "x declared and not used"
+ x := 7 // ERROR "x declared but not used"
}
func notused(x interface{}) {
// The first t is in a different scope than the 2nd t; it cannot
- // be accessed (=> declared and not used error); but it is legal
+ // be accessed (=> declared but not used error); but it is legal
// to declare it.
- switch t := 0; t := x.(type) { // ERROR "declared and not used"
+ switch t := 0; t := x.(type) { // ERROR "declared but not used"
case int:
_ = t // this is using the t of "t := x.(type)"
}