-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/compile: capture implicit constraints in export data #49040
Comments
I can do this. @griesemer and I discussed and this is probably as straightforward as exporting the embedded structural type, rather than the constraint interface itself, for implicit constraint interfaces. Then when importing, we can detect that the constraint is not an interface and wrap it in an implicit interface. Prototyped in https://golang.org/cl/357109. |
Change https://golang.org/cl/357796 mentions this issue: |
Add a new interface method, MarkImplicit, to allow marking interfaces as implicit from outside the type-checker. This is necessary so that we can capture the implicit bit in export data, and use it from importers. For #48424 For #49040 Change-Id: I999aba2a298f92432326d7ccbd87fe133a2e1a72 Reviewed-on: https://go-review.googlesource.com/c/go/+/357796 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Update: the test failures in the prototype highlighted that trying to "cheat" and compute whether an interface is implicit based on the constraint type, is unclean. We've decided to opt for an explicit bit in the export format. |
Change https://golang.org/cl/358034 mentions this issue: |
Add support for accepting the Go 1.18 export data version (2) to the x/tools gcimporter, while preserving support for generic code at version 1. For now, the exporter still outputs version 1. For golang/go#49040 Change-Id: Ic4547e385ced72b88212d150bf16acaf200a010e Reviewed-on: https://go-review.googlesource.com/c/tools/+/358034 Trust: Robert Findley <rfindley@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
@findleyr is there anything left to do here? |
No, I don't think so. Closing. |
Add support for accepting the Go 1.18 export data version (2) to the x/tools gcimporter, while preserving support for generic code at version 1. For now, the exporter still outputs version 1. For golang/go#49040 Change-Id: Ic4547e385ced72b88212d150bf16acaf200a010e Reviewed-on: https://go-review.googlesource.com/c/tools/+/358034 Trust: Robert Findley <rfindley@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
With #48424, we allow users to elide
interface{}
in constraint expressions. We expose this in the type checker asfunc (*Interface) IsImplicit() bool
. It would be nice to capture this in export data, so that we can preserve this implicit bit on import.CC @mdempsky @griesemer
The text was updated successfully, but these errors were encountered: