-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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, types2: audit type assertions for potential Alias bugs #67547
Comments
There are many assertions with type parameters that seem incorrect. I will take this on. |
Change https://go.dev/cl/587156 mentions this issue: |
Change https://go.dev/cl/587157 mentions this issue: |
This change adds an Unalias call in applyTypeFunc and arrayPtrDeref. At the moment this doesn't change anything or fix any bugs because of the way these two functions are invoked, but that could change in the future. Also, manually reviewed all type assertions to Type types. Excluding assertions to type parameters, no obvious issues were found except for #67540 for which a separate fix is pending. There are potential issues with assertions type parameters which will be addressed in a follow-up CL. For #67547. Change-Id: I312268dc5e104f95b68f115f00aec3ec4c82e41f Reviewed-on: https://go-review.googlesource.com/c/go/+/587156 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
Change https://go.dev/cl/587176 mentions this issue: |
…arameter For #67547. Change-Id: I1b2118a311dce906327ae6e29e582da539c60b2b Reviewed-on: https://go-review.googlesource.com/c/go/+/587157 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
Change https://go.dev/cl/587158 mentions this issue: |
Fixes regression from Go 1.22. For #67547. Change-Id: Idd319b9d2a73c824caa2c821df0e2fcd4f58cb08 Reviewed-on: https://go-review.googlesource.com/c/go/+/587176 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Fixes regression from Go 1.22. For #67547. Change-Id: I012681c7b8b01b02018b313dd3804690bc7aeed1 Reviewed-on: https://go-review.googlesource.com/c/go/+/587158 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/587159 mentions this issue: |
Change https://go.dev/cl/587161 mentions this issue: |
With these most recent CLs I believe the major issues here are covered. But I think for the freeze we're ok on this front. We may find more regressions but once found, they are easy to address. |
Fixes regression from Go 1.22. Fixes #67540. For #67547. Change-Id: I61f642970c6a9bd8567654bb5ecf645ae77b3bcc Reviewed-on: https://go-review.googlesource.com/c/go/+/587159 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Robert Griesemer <gri@google.com>
Fixes regression from Go 1.22. For #67547. Change-Id: Id0d07d6b24e1eab6ed1c7476d9d9b82d28aee80a Reviewed-on: https://go-review.googlesource.com/c/go/+/587161 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/587939 mentions this issue: |
Change https://go.dev/cl/587940 mentions this issue: |
For #67547. Change-Id: I999cd31f9a01f91e7984b4e7012c81e8bd9c6b06 Reviewed-on: https://go-review.googlesource.com/c/go/+/587940 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/587820 mentions this issue: |
Documentation change only. For #67547. Change-Id: I0da480299c33239bcd1e059f8b9c6d48d8f26609 Reviewed-on: https://go-review.googlesource.com/c/go/+/587820 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
Change https://go.dev/cl/588117 mentions this issue: |
Without a test because it's unclear the situation can actually occur, but the code is correct because it now mimics the behavior without explicit Alias nodes. For #67547. Change-Id: I21a31af28880ca6d599fe465563d9574c26ed1f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/588117 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Change https://go.dev/cl/588797 mentions this issue: |
Change https://go.dev/cl/588855 mentions this issue: |
While at it, rename asTypeParam to asBoundTypeParam for clarity. For #67547. Fixes #67628. Change-Id: I2f447c4cd4d72f5315fe9323d82fcb9bf33657c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/588797 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
For #67547. Fixes #67683. Change-Id: I9487820ab4e2bd257d253a7016df45729b29f836 Reviewed-on: https://go-review.googlesource.com/c/go/+/588855 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
All type assertions and type switches in go/types, types2, have been reviewed and updated as needed. |
#67540 fixes a bug where GODEBUG=gotypesalias=1 (the default in go 1.23) results in a type checker bug.
While reviewing the fix (https://go.dev/cl/587075), I noticed that right above that bug, there is another, allowing the following program to compile without error (the error comes from vet, not type checking, which may actually indicate another bug: is vet not honoring GODEBUG?):
https://go.dev/play/p/cy0Jma_6jAA?v=gotip
It appears that we need to more thoroughly audit type assertions within the type checker.
CC @griesemer @adonovan
The text was updated successfully, but these errors were encountered: