Closed ben-krieger closed 1 week ago
Thanks for the thorough review @dgryski! I'll spend some time this weekend fixing it up and adding more tests.
testdata/reflect.go
is still failing. That's Bad because the desired output is generated by upstream Go, so that indicates incompatibilities.
testdata/reflect.go
is still failing. That's Bad because the desired output is generated by upstream Go, so that indicates incompatibilities.
Got it. So it seems that arrays in some cases have become addrable and settable, when they shouldn't. Let me see if I can figure out why...
It's almost certainly the flag changes for indirect
support. You probably need some RO
bits too.
It's almost certainly the flag changes for
indirect
support. You probably need someRO
bits too.
Tried RO, but couldn't get it working, so I reverted the change that broke it. (I was also uncomfortable with that code, because I didn't understand the underlying mechanism that distinguished between arrays > 64 bits in size.) However, the test I added for reflect.Copy
is still failing.
Any thoughts on the proper way to fix #4554?
It's almost certainly the flag changes for
indirect
support. You probably need someRO
bits too.
@dgryski I think this is ready for (hopefully the last) review. All tests are passing now and the fix for #4554 matches a lot of other code within the reflect package that check either indirect OR size > uintptr.
I don't see any more low-hanging fruit for test coverage, but let me know what you think. Thanks!
One quick comment. I'll do a full review tomorrow (Monday) and then hopefully we can get this merged. Thanks for all your work on this!
@aykevl Any comments?
Took a look, looks good to me.
Fixes #4554
This PR adds a few things to the reflect package.
Value.Clear
interface{}
, i.e.reflect.ValueOf(42).Convert(reflect.TypeFor[interface{}]())
reflect.ValueOf([]int{1, 2, 3}).Convert(reflect.TypeFor[[3]int]())
reflect.Copy
when the source is an arrayThe motivation was to allow compiling the CBOR library at https://github.com/fido-device-onboard/go-fdo/tree/tinygo-server-support/cbor. However, this PR can be split into smaller ones if desired.