Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: #1042 reported invalid arguments being passed to
MV.slice
:This is surprising because afaik
maxSlot
0-indexes into a vector of sizesize
, thusmaxSlot < size
.Solution:
We were calling
and both cases of the
if
are wrong.If
Set.null freeInBody
then we should pass-1 8000
, indicating that no elements from the current stack are needed, and canceling the- 1
in the slice start index calculation.For the "else" case, the De Bruijn indices stored in
freeInBody
are relative to the not-yet-constructed stack, which includes evaluatedlet
binding. Since it's not yet part of the stack we are garbage collecting from, we need to subtract one from the max. So in the example above,maxSlot=129
was wrong; it should have been128
, so we'd get a slice start index of 0 (129 - 128 - 1
) instead of -1.We end up with: