Conversation
030212b to
bac0d78
Compare
There was a problem hiding this comment.
I added a few more tests here, because I noticed we were never really validating the encoding itself just the operation. These tests validate things like endianness.
| let buf = Buffer.make(0) | ||
| Buffer.addBytes(bytes, buf) | ||
| assert Buffer.toBytes(buf) == bytes | ||
| let buffer = Buffer.make(0) |
There was a problem hiding this comment.
I ran into a bug elsewhere for this in the stdlib and figured it should have a dedicated test.
There was a problem hiding this comment.
There still seems to be a bug in atof somewhere causing overreads and slightly invalid numbers which is causing the Number and Json modules to fail their test.
I was having trouble tracking down the source though. I noticed that there are some cases where we were a bit laxed on our boundary checks before here, which may be part of the problem.
| i += 1n | ||
| } else { | ||
| break | ||
| if (i < len) { |
There was a problem hiding this comment.
This is one such case where we were being a bit laxed before, the loop could go all the way to len and then when this tries to read it fails. I tried to correct the cases I could find, but I couldn't track them all down.
|
|
||
| let simple = tagSimpleNumber(n) | ||
|
|
||
| if (untagSimpleNumber(simple) is n) { |
There was a problem hiding this comment.
The is check here was causing an invalid module error.
| provide let _GRAIN_NUMBER_TAG_TYPE = 0b0001n | ||
| provide let _GRAIN_SHORTVAL_TAG_TYPE = 0b0010n | ||
| provide let _GRAIN_CONST_TAG_TYPE = 0b0110n | ||
| provide let _GRAIN_GENERIC_HEAP_TAG_TYPE = 0b0000n |
There was a problem hiding this comment.
This is no longer a concept
|
|
||
| // Handle lists separately to avoid stack overflow | ||
| if (DataStructures.loadVariantTypeId(xptr) is _LIST_ID) { | ||
| if (xVariantTag >> 1n == 1n) return true // End of list |
There was a problem hiding this comment.
I think you introduced this bug in one of your prior commits, but we already untagged it. So this was causing equality issues.
| @@ -63,6 +62,7 @@ primitive typeMetadata = "@heap.type_metadata" | |||
| let findTypeMetadata = typeHash => { | |||
| let typeMetadata = typeMetadata() | |||
There was a problem hiding this comment.
I think we may want to make typeMetadata() return -1 or 0 if type metadata is elided. I need the eqz check on the number of buckets or we get a divide by zero error.
| 8n | ||
| ) | ||
| ignore(array) | ||
| arr[i] = (key, value) |
There was a problem hiding this comment.
We may want to consider doing this in more of the places we are doing Array.setAnyValue
This appears to have been because we were not considering the bom properly and not properly doing the end calculation.
No description provided.