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
reflect: factor out special channel assignability rule from haveIdenticalUnderlyingType #29739
Conversation
This PR (HEAD: 54527fc) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Ian Lance Taylor: Patch Set 1: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: ccd30dc) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 3:
I modified the commit message and test file.
This PR doesn't deny this. And it looks, this is only possible place which could cause the bug. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: e5f3a18) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 5: In other "haveIdenticalUnderlyingType" calls, three are for function and three are for struct types, the modification in this PR doesn't affect the six uses. The 2nd "haveIdenticalUnderlyingType" call in "convertOp" causes the new bug #29469 (comment) (the PR unrelated). Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 5:
Yes, exactly. In particular, it seems that this might change the behavior when working with types like type C1 chan int The Go spec section that you mention talks only about converting between types at the top level, while it appears that this change is going to affect converting between types at other levels. This does not seem to me to be the only place that could cause this bug. Since the bug seems to only be about the top level types being converted, we could add a case to the directlyassignable function. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Tapir Liu: Patch Set 5: The PR also doesn't affect the "haveIdenticalUnderlyingType" call in the "haveIdenticalType" function. So now, the only side effects may happen is for the 2nd
Agree, and we also need add a case (for the special chnannel assignability) in the convertOp function. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: 37b24b2) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 5: pushed a new patch. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Tapir Liu: Patch Set 7: done. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
4a7ed1f
to
0f992b9
Compare
Message from Brad Fitzpatrick: Patch Set 10: Ian, I fixed the commit message. Want to review? Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Brad Fitzpatrick: Patch Set 10: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Tapir Liu: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Tapir Liu: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Tapir Liu: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: bf2718c) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 15: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 15: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: e7cde2b) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 16: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 16: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR (HEAD: 487c20a) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/157822 to see it. Tip: You can toggle comments from me using the |
Message from Tapir Liu: Patch Set 17: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 17: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Gobot Gobot: Patch Set 17: TryBots beginning. Status page: https://farmer.golang.org/try?commit=8575560a Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Gobot Gobot: Patch Set 17: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 18: Patch Set 17 was rebased Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Ian Lance Taylor: Patch Set 18: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Gobot Gobot: Patch Set 18: TryBots beginning. Status page: https://farmer.golang.org/try?commit=ca32bcb1 Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Gobot Gobot: Patch Set 18: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
Message from Gobot Gobot: Patch Set 18: TryBot-Result-1 1 of 21 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
…icalUnderlyingType Go specification says: A value x is assignable to a variable of type T if x is a bidirectional channel value, T is a channel type, x's type V and T have identical element types, and at least one of V or T is not a defined type. However, the current reflection implementation is incorrect which makes "x is assignable to T" even if type V and T are both defined type. The current reflection implementation also mistakes the base types of two non-defined pointer types share the same underlying type when the two base types satisfy the above mentioned special channel assignability rule. Fixes #29469 Change-Id: Ia4b9c4ac47dc8e76a11faef422b2e5c5726b78b3 GitHub-Last-Rev: 487c20a GitHub-Pull-Request: #29739 Reviewed-on: https://go-review.googlesource.com/c/go/+/157822 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Message from Ian Lance Taylor: Patch Set 18: Code-Review+2 Thanks for pushing through this. Please don’t reply on this GitHub thread. Visit golang.org/cl/157822. |
This PR is being closed because golang.org/cl/157822 has been merged. |
Go specification says: A value x is assignable to a variable of type T if x
is a bidirectional channel value, T is a channel type, x's type V and T have
identical element types, and at least one of V or T is not a defined type.
However, the current reflection implementation is incorrect which makes
"x is assignable to T" even if type V and T are both defined type.
The current reflection implementation also mistakes the base types of two
non-defined pointer types share the same underlying type when the two
base types satisfy the above mentioned special channel assignability rule.
Fixes #29469