Document the byte-array aset coercions as permissive divergences - #888
Merged
Conversation
A store into a byte array narrows an out-of-range integer the way Byte.byteValue() does, and coerces a flonum index (floor) and value (truncate toward zero). The JVM's aset rejects all of these: RT.aset's byte and int parameters take a Byte/Long only, so (aset (byte-array 2) 0 200) is "No matching method aset found taking 3 args". Only the constructor narrows there; (byte-array [200]) is -56 on both. PR #887's array-backing rows pin the jolt contract value for value but nothing recorded that the JVM disagrees. Two :permissive entries now do, one per shape, with :check values recorded from both gate halves. Closes jolt-8eef.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up from reviewing #887. jolt's byte-array store narrows an out-of-range integer (200 -> -56, -129 -> 127) and coerces a flonum index and value, the same seam every door into a byte array uses. The JVM's aset throws IllegalArgumentException on each of these, since RT.aset(byte[], int, byte) takes a Byte only; just the constructor narrows there, so (byte-array [200]) is -56 on both runtimes.
The array-backing rows added in #887 pin that contract but no known-divergences entry said the JVM does not share it. This adds two :permissive entries, one for the integer narrowing and one for the flonum index/value, with :check values recorded from both halves of the gate.
make documented: 48/48 machine-checked, 21 proseCloses jolt-8eef.