reflect: address Copilot review feedback

This commit is contained in:
Damian Gryski
2026-05-29 15:09:57 -07:00
committed by Damian Gryski
parent 1c0c26b8b7
commit 7fa50a55cf
2 changed files with 4 additions and 8 deletions
+1 -2
View File
@@ -754,8 +754,7 @@ func (t *RawType) FieldAlign() int {
return t.Align()
}
// ConvertibleTo returns wheather a value of type t can be converted to a variable of of type u
// ConvertibleTo returns whether a value of type t can be converted to a variable of type u
func (r *RawType) ConvertibleTo(u *RawType) bool {
// This logic is mostly copied from Value.CanConvert
+3 -6
View File
@@ -1494,9 +1494,9 @@ func convertOp(src Value, typ Type) (Value, bool) {
}
case Complex64, Complex128:
switch src.Kind() {
switch rtype := typ.(*RawType); rtype.Kind() {
case Complex64, Complex128:
return cvtComplex(src, typ.(*RawType)), true
return cvtComplex(src, rtype), true
}
case Slice:
@@ -1543,7 +1543,7 @@ func convertOp(src Value, typ Type) (Value, bool) {
case Pointer:
rtype := typ.(*RawType)
if rtype.Kind() == Pointer && !rtype.isNamed() {
if rtype.Kind() == Pointer && !src.typecode.isNamed() && !rtype.isNamed() && src.typecode.elem().underlying() == rtype.elem().underlying() {
return cvtDirect(src, rtype), true
}
}
@@ -1708,9 +1708,6 @@ func makeComplex(flags valueFlags, f complex128, t *RawType) Value {
return v
}
//go:linkname stringFromUnicode runtime.stringFromUnicode
func stringFromUnicode(x rune) string
func cvtIntString(v Value, t *RawType) Value {
s := "\uFFFD"
if x := v.Int(); int64(rune(x)) == x {