diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-07-04 12:20:36 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-07-05 17:08:02 -0700 |
commit | ccc39d9e97ce24623aefae2097bff791e01619d9 (patch) | |
tree | b4b5e4a4333769a7424f4d84107490a6fd9b966f /gcc/go | |
parent | bd2d0aab4d259fe579db294467c366b7737f3488 (diff) | |
download | gcc-ccc39d9e97ce24623aefae2097bff791e01619d9.zip gcc-ccc39d9e97ce24623aefae2097bff791e01619d9.tar.gz gcc-ccc39d9e97ce24623aefae2097bff791e01619d9.tar.bz2 |
compiler: better error message for unknown package name
Fixes golang/go#51237
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415994
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 7b1d301..461e2fd 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6479d5976c5d848ec6f5843041275723a00006b0 +a209dca9ec918535977dcab99fd9bb60986ffacd The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index a3c6f63..c93d82b 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -191,7 +191,11 @@ Parse::qualified_ident(std::string* pname, Named_object** ppackage) Named_object* package = this->gogo_->lookup(name, NULL); if (package == NULL || !package->is_package()) { - go_error_at(this->location(), "expected package"); + if (package == NULL) + go_error_at(this->location(), "reference to undefined name %qs", + Gogo::message_name(name).c_str()); + else + go_error_at(this->location(), "expected package"); // We expect . IDENTIFIER; skip both. if (this->advance_token()->is_identifier()) this->advance_token(); |