You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing importers go out of their way to augment partially imported packages (types, etc.).
A source importer doesn't do that - it uses go/types to always create a new package. If only the source importer is used, then (recursively), any package that is imported somewhere is imported as a whole, so all packages are complete upon import and there's never a need to augment a package.
If we want to provide a "mixed-mode" importer, where some packages are imported from installed packages, and some from source, depending on which is newer, the above is not so simple anymore: A package may be imported from an installed location, which in turn may contain partial package information about another package.
If that other package is imported from source, it must augment the partial package in the packages map rather than replace it.
This matters only for types since they are the only objects that may be used in the construction of other package-level objects - they must be unique.
One could expand the go/types API and provide a partially complete package that is then expanded. Or one could do a "full" import and then somehow merge the new with the old package (and update any types that need to be canonicalized - a tricky proposition).
Or one could disallow "mixed-mode" imports (currently they are not supported anyway).
Needs to be resolved before we can implement mixed-mode imports.
The text was updated successfully, but these errors were encountered:
See the issue below for details.
For #19337.
Change-Id: I7637dcd4408f1bc4a9b3050a107aadb4de6f950b
Reviewed-on: https://go-review.googlesource.com/37620
Reviewed-by: Alan Donovan <adonovan@google.com>
The existing importers go out of their way to augment partially imported packages (types, etc.).
A source importer doesn't do that - it uses go/types to always create a new package. If only the source importer is used, then (recursively), any package that is imported somewhere is imported as a whole, so all packages are complete upon import and there's never a need to augment a package.
If we want to provide a "mixed-mode" importer, where some packages are imported from installed packages, and some from source, depending on which is newer, the above is not so simple anymore: A package may be imported from an installed location, which in turn may contain partial package information about another package.
If that other package is imported from source, it must augment the partial package in the packages map rather than replace it.
This matters only for types since they are the only objects that may be used in the construction of other package-level objects - they must be unique.
One could expand the go/types API and provide a partially complete package that is then expanded. Or one could do a "full" import and then somehow merge the new with the old package (and update any types that need to be canonicalized - a tricky proposition).
Or one could disallow "mixed-mode" imports (currently they are not supported anyway).
Needs to be resolved before we can implement mixed-mode imports.
The text was updated successfully, but these errors were encountered: