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: Scope.Pos/End are zero for file and package scopes #11464

Closed
alandonovan opened this issue Jun 29, 2015 · 1 comment
Closed

go/types: Scope.Pos/End are zero for file and package scopes #11464

alandonovan opened this issue Jun 29, 2015 · 1 comment

Comments

@alandonovan
Copy link
Contributor

I would expect the lexical extent of these scopes to be a single file, and all the files of the package, respectively. We could make them nonzero, or document the status quo.

If we make them nonzero, we'll need to make Scope.LookupParent aware of file and packages since the pos check should be ignored for these scopes. That's easy enough, and I think we should do it, but only for file scopes.

If we make the extent of a Package scope nonzero, then a package formed from two calls to checker.Files would need its scope extent to be expanded. Since the second list of ast.Files does not usually immediately follow the first, this would result in a package whose scope extent contains the scope extent of other files and packages, which would be very confusing. So I propose that we don't change the extent of the Package scope but merely document it as zero.

@alandonovan
Copy link
Contributor Author

Never mind. There are a number of errors in this bug report. Need more coffee...

@golang golang locked and limited conversation to collaborators Jun 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants