Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(946)

Unified Diff: go/types/expr.go

Issue 8092048: code review 8092048: go.exp/go/types: better error message for non-existing ... (Closed)
Patch Set: diff -r 2cd982aef585 https://code.google.com/p/go.exp Created 10 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | go/types/testdata/decls0.src » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/types/expr.go
===================================================================
--- a/go/types/expr.go
+++ b/go/types/expr.go
@@ -1145,11 +1145,14 @@
if ident, ok := e.X.(*ast.Ident); ok {
if pkg, ok := check.lookup(ident).(*Package); ok {
exp := pkg.Scope.Lookup(sel)
- // gcimported package scopes contain non-exported
- // objects such as types used in partially exported
- // objects - do not accept them
- if exp == nil || !ast.IsExported(exp.GetName()) {
- check.errorf(e.Pos(), "cannot refer to unexported %s", e)
+ if exp == nil {
+ check.errorf(e.Pos(), "%s not declared by package %s", sel, ident)
+ goto Error
+ } else if !ast.IsExported(exp.GetName()) {
+ // gcimported package scopes contain non-exported
+ // objects such as types used in partially exported
+ // objects - do not accept them
+ check.errorf(e.Pos(), "%s not exported by package %s", sel, ident)
goto Error
}
check.register(e.Sel, exp)
« no previous file with comments | « no previous file | go/types/testdata/decls0.src » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b