Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: Document that the caller must populate desired fields of types.Info #12787

Closed
creachadair opened this issue Sep 29, 2015 · 4 comments
Closed
Assignees

Comments

@creachadair
Copy link

@creachadair creachadair commented Sep 29, 2015

In the comment for the go/types.(*Config).Check method, it says:

Check type-checks a package and returns the resulting package object, the first error if any, and if info != nil, additional type information.

What it does not mention is that the caller must explicitly populate any of the map fields of this type that are to be filled in—it is not sufficient to simply pass a *types.Info. Ideally the documentation would make this explicit, say perhaps:

The type-checker populates each non-nil map field with the corresponding type information. If a given map field is nil, its information will be discarded.

or words to that effect. I'll be happy to send a PR for this (or similar), if we can agree on the wording.

@griesemer griesemer self-assigned this Sep 29, 2015
@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 29, 2015

Actually, this is documented with the Info struct:

"Only the information for which a map is provided is collected."

Loading

@griesemer griesemer closed this Sep 29, 2015
@creachadair
Copy link
Author

@creachadair creachadair commented Sep 29, 2015

It might be helpful to at least mention that in the Check documentation
anyway.

On Tue, Sep 29, 2015 at 12:49 PM, Robert Griesemer <notifications@github.com

wrote:

Closed #12787 #12787.

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 29, 2015

Will consider as part of another CL.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 29, 2015

CL https://golang.org/cl/15150 mentions this issue.

Loading

griesemer added a commit that referenced this issue Sep 29, 2015
For #12787.

Change-Id: I921d01c8d7d97f3453b25e6d2241a43c5d64f53b
Reviewed-on: https://go-review.googlesource.com/15150
Reviewed-by: Alan Donovan <adonovan@google.com>
@golang golang locked and limited conversation to collaborators Sep 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants