Commit 4e8d270
reflect: factor out special channel assignability rule from haveIdenticalUnderlyingType
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>1 parent dd8bbc7 commit 4e8d270
3 files changed
+63
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3634 | 3634 | | |
3635 | 3635 | | |
3636 | 3636 | | |
| 3637 | + | |
| 3638 | + | |
| 3639 | + | |
| 3640 | + | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
3637 | 3644 | | |
3638 | 3645 | | |
3639 | 3646 | | |
| |||
3995 | 4002 | | |
3996 | 4003 | | |
3997 | 4004 | | |
3998 | | - | |
3999 | | - | |
4000 | | - | |
4001 | | - | |
4002 | 4005 | | |
4003 | 4006 | | |
4004 | 4007 | | |
| |||
4010 | 4013 | | |
4011 | 4014 | | |
4012 | 4015 | | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
4013 | 4050 | | |
4014 | 4051 | | |
4015 | 4052 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1542 | 1542 | | |
1543 | 1543 | | |
1544 | 1544 | | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
1545 | 1557 | | |
1546 | 1558 | | |
1547 | 1559 | | |
| |||
1559 | 1571 | | |
1560 | 1572 | | |
1561 | 1573 | | |
1562 | | - | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
1563 | 1579 | | |
1564 | 1580 | | |
1565 | 1581 | | |
| |||
1597 | 1613 | | |
1598 | 1614 | | |
1599 | 1615 | | |
1600 | | - | |
1601 | | - | |
1602 | | - | |
1603 | | - | |
1604 | | - | |
1605 | | - | |
1606 | | - | |
1607 | | - | |
1608 | 1616 | | |
1609 | 1617 | | |
1610 | 1618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2476 | 2476 | | |
2477 | 2477 | | |
2478 | 2478 | | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
2479 | 2484 | | |
2480 | 2485 | | |
2481 | 2486 | | |
| |||
0 commit comments