Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/gcimporter: document non-idempotence of export∘import
In gopls we were recently surprised to discover that the the message obtained by exporting a types.Package, and the message obtained by importing and reexporting that message, differ. (Specifically because the importer calls NewInterfaceType, which has a shortcut for empty interfaces, and this shortcut is not used by go/types, so the importer produces a more compact data structure than go/types. There may be other examples.) This change documents the longstanding invariant that the encoding is deterministic for a given types.Package data structure, while also explicitly disclaiming that the composition of export∘import is idemptotent. Change-Id: Ie07efc1046315cd2104e78714d8312ecdf10e817 Reviewed-on: https://go-review.googlesource.com/c/tools/+/472075 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
- Loading branch information