Fix a bug with indirect produce calls in a loop #192
Merged
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.
We had a bug where if a function had a
producecall in it, and was called multiple times in a loop, the position counter was not being reset as it should have. For instance, here's the new test introduced in this PR:Before this PR, what would happen here is that on first
consumecall we would hitproduceinproduce_wrapper, andproduce_wrapperwould set its position counter so that when it's next called, execution continues from after theproducecall (which has been turned into areturn ProducedValue(x)). On second call toconsumeexecution would continue from there, andproduce_wrapperwould return. So far so good. But thenfwould callproduce_wrapperagain, but its position counter would still be stuck saying that execution should continue right after theproducecall. Thus the above test used to fail withThis came up in #190 after the immediate issue crashing issue was fixed.