go/types: change (*types.Package)(nil).Scope() to return types.Universe instead of panicking #46594
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Maybe because I'm accustomed to working in cmd/compile where we represent the universe as a package, but I find myself often writing
obj.Pkg().Scope()
, which then fails for predeclared objects. So I always end up having to go back and change it to explicitly check theobj.Pkg()
result fornil
and to usetypes.Universe
instead.It would be a nice convenience IMO if
(*types.Package)(nil).Scope()
just evaluated totypes.Universe
instead./cc @griesemer @findleyr @dominikh
The text was updated successfully, but these errors were encountered: