compiler: reword "declared and not used" error message
This is a gofrontend copy of https://golang.org/cl/203282.
From the CL 203282 description:
"declared and not used" is technically correct, but might confuse
the user. Switching "and" to "but" will hopefully create the
contrast for the users: they did one thing (declaration), but
not the other --- actually using the variable.
Change-Id: Ie302171c3c6aa6d4429dc125cf994be8ad58554a
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273629
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/gogo.cc b/go/gogo.cc
index 93a4a57..a5e4521 100644
--- a/go/gogo.cc
+++ b/go/gogo.cc
@@ -3744,7 +3744,7 @@
&& !var->type()->is_error()
&& (init == NULL || !init->is_error_expression())
&& !Lex::is_invalid_identifier(named_object->name()))
- go_error_at(var->location(), "%qs declared and not used",
+ go_error_at(var->location(), "%qs declared but not used",
named_object->message_name().c_str());
}
return TRAVERSE_CONTINUE;
diff --git a/go/parse.cc b/go/parse.cc
index 00ac2f8..b1925ed 100644
--- a/go/parse.cc
+++ b/go/parse.cc
@@ -4817,7 +4817,7 @@
}
}
if (!used)
- go_error_at(type_switch.location, "%qs declared and not used",
+ go_error_at(type_switch.location, "%qs declared but not used",
Gogo::message_name(var_name).c_str());
}
return statement;