Repository navigation
Give a Nibble the value of its four bits - #723
Merged
Merged
Conversation
lagergren
added a commit
that referenced
this pull request
Oct 23, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Oct 23, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
ggleyzer
approved these changes
Oct 24, 2026
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
Review of #723: the comments in constructFromBits() and the bits property now give the example, a Nibble 0xC stored as 0xC0, in the wording the review proposed. Validation: comments only; :javatools:compileJava and spotlessCheck pass. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
Review of #723: the comments in constructFromBits() and the bits property now give the example, a Nibble 0xC stored as 0xC0, in the wording the review proposed. Validation: comments only; :javatools:compileJava and spotlessCheck pass. Limits: none.
lagergren
force-pushed
the
lagergren/fix-nibble-from-bits
branch
from
October 26, 2026 10:16
01b5f51 to
d387b67
Compare
xConstrainedInteger, the native template of the fixed-width integers,
handled a Nibble's 4 bits as if they filled a byte:
- constructFromBits() read the bits as the bytes they are packed in,
from the most significant bit down, so a Nibble's bits were the high
half of a byte: [1, 0, 0, 1] read as 0x90, and Nibble's mask then left
0. Nibble makes its table of values that way, so Nibble.of(Int),
Nibble.of(Char), IntLiteral.toNibble() and Char.isNibble() all gave 0,
for every value. It now shifts out the unused low bits.
- The bits property made a byte array of f_cNumBits / 8 bytes, none for
a Nibble, and failed with an IllegalStateException. It now puts the
value in the high bits of its byte, as constructFromBits() reads them.
- constructFromString(), which answers Nibble(String), checked the value
by its size in whole bytes, so every Nibble overflowed. A value
narrower than a byte is now checked against its range.
Tests: the new NibbleTest runs a module, in a JVM of its own so that its
runtime does not stay in the test JVM, that checks a Nibble made from
its bits, Nibble.of() of 0 to F as numbers and as hexits,
0xA.toNibble(), 'c'.isNibble(), new Nibble("7"), that "16" overflows,
and Nibble.of(0xC).bits and back.
Validation: on master, the module ends with "OutOfBounds:
numbers.Nibble overflow" at new Nibble("7"), and before that the table
gives 0 for all sixteen values; with the fix, NibbleTest passes. After
xdk:installDist, check passes, with the Ecstasy libraries' tests:
lib_json's JsonTest passes 175 and lib_metrics' MetricsTest 4;
:javatools:test passes 457 tests, the 42 existing skips; spotlessCheck
passes.
Problems found and fixed:
- Found while testing native toString() (#722), whose test makes its
Nibbles from an Int64 because of this.
Limits: Nibble(Byte[]) still fails: Nibble's own constructor asserts one
byte, and Number's makes 8 bits of it, which Nibble's bits constructor
refuses; that is the library's to settle. Nothing else in the template
assumes a whole number of bytes.
The checks of NibbleTest move into testNibble() in TestNumbers, which CI runs with the other manual tests (runCiTestTasks): plain asserts, like the rest of numbers.x, instead of a JUnit test that compiled and ran a module in a JVM of its own. A failed assert ends the module with exit code 1, which fails its run task. Validation: TestNumbers through manualTests:runOne passes; with master's xConstrainedInteger.java it fails at the first Nibble assert, "new Nibble(Array<Bit>:[0, 0, 0, 1]).toInt64() == 1", and the task fails with "Module 'TestNumbers' execution failed with exit code: 1". spotlessCheck passes. Limits: the checks run where manualTests runs, in CI or with -PincludeBuildManualTests=true -PincludeBuildAttachManualTests=true, not in :javatools:test. The overflow check catches OutOfBounds only, so a "16" that does not overflow fails at its assert.
Review of #723: the comments in constructFromBits() and the bits property now give the example, a Nibble 0xC stored as 0xC0, in the wording the review proposed. Validation: comments only; :javatools:compileJava and spotlessCheck pass. Limits: none.
lagergren
force-pushed
the
lagergren/fix-nibble-from-bits
branch
from
October 26, 2026 10:28
d387b67 to
72fccdd
Compare
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
lib_json's Lexer read the four hexits of a \u escape, shifted each of them 8 bits where it meant to make one 16-bit value of them, and then added nothing to the string: every \u escape was dropped. lib_json's own Printer writes control characters as \u escapes, so it could not read them back. The hexits went through Nibble.of(), which on master gives 0 for every hexit (#723), so the value was 0 as well. - The four hexits are read with Char.asciiHexit(), which does not use Nibble, into one 16-bit value, and the character is added. - A character beyond the Basic Multilingual Plane, which JSON writes as a UTF-16 surrogate pair, is read as one Char; a Char cannot hold a surrogate. - A character that is not a hexit, a low surrogate on its own, and a high surrogate that no low one follows are IOExceptions, as the lexer's other malformed input is. Tests, in lib_json's ParsingTest: - shouldParseUnicodeEscapes: A, é and É, with upper and lower case hexits, and U+2028. - shouldParseASurrogatePairAsOneCharacter: 😀 reads as U+1F600. - shouldReadBackTheControlCharactersItWrites: Printer writes U+0001 and U+001F as \u escapes, and they read back as the string written. - shouldRejectABadUnicodeEscape: the three malformed cases above, and a high surrogate followed by a \u escape that is not a low surrogate. The tests make each escape as "\\" + "u" + hexits: the compiler reads a backslash, a "u" and four hexits as that character, also in a String literal, which is why Printer's table is written that way too. Validation: the four new tests fail without the fix, and pass with it; JsonTest passes 179, forced to run again. check passes; :javatools:test passes 456 tests, the 42 existing skips; spotlessCheck passes. Problems found and fixed: - Found while looking at Nibble.of()'s callers for #723. - Found, not fixed here: Char.appendEscaped() writes the first three hexits of a \u escape as 0, since `codepoint & 0xF000 >>> 24` is `codepoint & 0`, so U+2028 is written as \u0008. Limits: the runtime keeps a String's chars as Java chars, so a Char beyond the Basic Multilingual Plane still becomes the one char a Char[] holds for it; the surrogate pair test compares with that Char's own String. Other escapes the lexer does not know are still dropped without an error, as before.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
lib_json's Lexer read the four hexits of a \u escape, shifted each of them 8 bits where it meant to make one 16-bit value of them, and then added nothing to the string: every \u escape was dropped. lib_json's own Printer writes control characters as \u escapes, so it could not read them back. The hexits went through Nibble.of(), which on master gives 0 for every hexit (#723), so the value was 0 as well. - The four hexits are read with Char.asciiHexit(), which does not use Nibble, into one 16-bit value, and the character is added. - A character beyond the Basic Multilingual Plane, which JSON writes as a UTF-16 surrogate pair, is read as one Char; a Char cannot hold a surrogate. - A character that is not a hexit, a low surrogate on its own, and a high surrogate that no low one follows are IOExceptions, as the lexer's other malformed input is. Tests, in lib_json's ParsingTest: - shouldParseUnicodeEscapes: A, é and É, with upper and lower case hexits, and U+2028. - shouldParseASurrogatePairAsOneCharacter: 😀 reads as U+1F600. - shouldReadBackTheControlCharactersItWrites: Printer writes U+0001 and U+001F as \u escapes, and they read back as the string written. - shouldRejectABadUnicodeEscape: the three malformed cases above, and a high surrogate followed by a \u escape that is not a low surrogate. The tests make each escape as "\\" + "u" + hexits: the compiler reads a backslash, a "u" and four hexits as that character, also in a String literal, which is why Printer's table is written that way too. Validation: the four new tests fail without the fix, and pass with it; JsonTest passes 179, forced to run again. check passes; :javatools:test passes 456 tests, the 42 existing skips; spotlessCheck passes. Problems found and fixed: - Found while looking at Nibble.of()'s callers for #723. - Found, not fixed here: Char.appendEscaped() writes the first three hexits of a \u escape as 0, since `codepoint & 0xF000 >>> 24` is `codepoint & 0`, so U+2028 is written as \u0008. Limits: the runtime keeps a String's chars as Java chars, so a Char beyond the Basic Multilingual Plane still becomes the one char a Char[] holds for it; the surrogate pair test compares with that Char's own String. Other escapes the lexer does not know are still dropped without an error, as before.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
lib_json's Lexer read the four hexits of a \u escape, shifted each of them 8 bits where it meant to make one 16-bit value of them, and then added nothing to the string: every \u escape was dropped. lib_json's own Printer writes control characters as \u escapes, so it could not read them back. The hexits went through Nibble.of(), which on master gives 0 for every hexit (#723), so the value was 0 as well. - The four hexits are read with Char.asciiHexit(), which does not use Nibble, into one 16-bit value, and the character is added. - A character beyond the Basic Multilingual Plane, which JSON writes as a UTF-16 surrogate pair, is read as one Char; a Char cannot hold a surrogate. - A character that is not a hexit, a low surrogate on its own, and a high surrogate that no low one follows are IOExceptions, as the lexer's other malformed input is. Tests, in lib_json's ParsingTest: - shouldParseUnicodeEscapes: A, é and É, with upper and lower case hexits, and U+2028. - shouldParseASurrogatePairAsOneCharacter: 😀 reads as U+1F600. - shouldReadBackTheControlCharactersItWrites: Printer writes U+0001 and U+001F as \u escapes, and they read back as the string written. - shouldRejectABadUnicodeEscape: the three malformed cases above, and a high surrogate followed by a \u escape that is not a low surrogate. The tests make each escape as "\\" + "u" + hexits: the compiler reads a backslash, a "u" and four hexits as that character, also in a String literal, which is why Printer's table is written that way too. Validation: the four new tests fail without the fix, and pass with it; JsonTest passes 179, forced to run again. check passes; :javatools:test passes 456 tests, the 42 existing skips; spotlessCheck passes. Problems found and fixed: - Found while looking at Nibble.of()'s callers for #723. - Found, not fixed here: Char.appendEscaped() writes the first three hexits of a \u escape as 0, since `codepoint & 0xF000 >>> 24` is `codepoint & 0`, so U+2028 is written as \u0008. Limits: the runtime keeps a String's chars as Java chars, so a Char beyond the Basic Multilingual Plane still becomes the one char a Char[] holds for it; the surrogate pair test compares with that Char's own String. Other escapes the lexer does not know are still dropped without an error, as before.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
lib_json's Lexer read the four hexits of a \u escape, shifted each of them 8 bits where it meant to make one 16-bit value of them, and then added nothing to the string: every \u escape was dropped. lib_json's own Printer writes control characters as \u escapes, so it could not read them back. The hexits went through Nibble.of(), which on master gives 0 for every hexit (#723), so the value was 0 as well. - The four hexits are read with Char.asciiHexit(), which does not use Nibble, into one 16-bit value, and the character is added. - A character beyond the Basic Multilingual Plane, which JSON writes as a UTF-16 surrogate pair, is read as one Char; a Char cannot hold a surrogate. - A character that is not a hexit, a low surrogate on its own, and a high surrogate that no low one follows are IOExceptions, as the lexer's other malformed input is. Tests, in lib_json's ParsingTest: - shouldParseUnicodeEscapes: A, é and É, with upper and lower case hexits, and U+2028. - shouldParseASurrogatePairAsOneCharacter: 😀 reads as U+1F600. - shouldReadBackTheControlCharactersItWrites: Printer writes U+0001 and U+001F as \u escapes, and they read back as the string written. - shouldRejectABadUnicodeEscape: the three malformed cases above, and a high surrogate followed by a \u escape that is not a low surrogate. The tests make each escape as "\\" + "u" + hexits: the compiler reads a backslash, a "u" and four hexits as that character, also in a String literal, which is why Printer's table is written that way too. Validation: the four new tests fail without the fix, and pass with it; JsonTest passes 179, forced to run again. check passes; :javatools:test passes 456 tests, the 42 existing skips; spotlessCheck passes. Problems found and fixed: - Found while looking at Nibble.of()'s callers for #723. - Found, not fixed here: Char.appendEscaped() writes the first three hexits of a \u escape as 0, since `codepoint & 0xF000 >>> 24` is `codepoint & 0`, so U+2028 is written as \u0008. Limits: the runtime keeps a String's chars as Java chars, so a Char beyond the Basic Multilingual Plane still becomes the one char a Char[] holds for it; the surrogate pair test compares with that Char's own String. Other escapes the lexer does not know are still dropped without an error, as before.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Oct 29, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
lagergren
added a commit
that referenced
this pull request
Nov 2, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Nov 2, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 2, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 2, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 2, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
lagergren
added a commit
that referenced
this pull request
Nov 4, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Nov 4, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 4, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 4, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 4, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
lagergren
added a commit
that referenced
this pull request
Nov 5, 2026
docs/remaining.md gives each master candidate its pull request: the weak map fix #720, also on #693 as a5e25c7, the EvalCompiler fixes #721, native toString() #722, the Nibble fix #723, which now covers its bits and String constructor as well, and lib_json's \u escapes #724, found through Nibble.of()'s callers. A bug found with #724 and not fixed is added: Char.appendEscaped() writes the first three hexits of a \u escape as 0. Validation: records only; each pull request's validation is in its commit and description. The appendEscaped() output was checked on master: 0x2028.toChar().quoted() is '\u0008'. Limits: none of the pull requests has a review yet.
lagergren
added a commit
that referenced
this pull request
Nov 5, 2026
Its JUnit test, which ran a module in a JVM of its own, became testNibble() in manualTests' numbers.x, which CI runs with the other manual tests. Validation: records only. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 5, 2026
docs/remaining.md: #723 is merged as 80bf83f. #722 is closed after review, since the interpreter keeps natural Ecstasy code and speed is the JIT's; its item is declined. #717 no longer carries the UID change, as decided on #677, which stays on this branch only. #719 replaces #718: both fix the hang, neither test catches it, and #719 has no debugger a host supplies, which now comes with the DAP work, and with it the refiling of the EvalCompiler fixes. #720's and #724's review changes are recorded, #720's with this branch's copy, 7fe6450. Validation: records only. The hang was reproduced with a program that runs a module with assert:debug through EmbeddingSupport and a standard input that stays open: master waits at "Enter command:", #718 and #719 end. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 5, 2026
docs/remaining.md's master candidates now name the pull requests for the two library bugs found while fixing #723 and #724: #730 writes a Char's \u escape with its own four hexits, and #731 gives a Nibble one byte as its bytes and makes a Nibble from one. Issue #729 asks whether an escaped backslash should keep a \u after it from being a Unicode escape, which #730's test has to work around. Validation: records only; the pull requests carry their own. Limits: none.
lagergren
added a commit
that referenced
this pull request
Nov 5, 2026
remaining.md: L82's uninterrupted full-catalog VS Code run is done (run-Pc161s, 332 of 333 with UP23's accepted X218; again on vscode-languageclient 11.0.0); the master candidates name what merged (#716, #717, #718, #720, #723, #731, #735), what closed, and #724 as the one still open; #693's sync line has its rebase onto #742 and its commit 71. The plan's opening and inventory name the 2026-10-28 full-catalog runs in both editors instead of the October 7 checkpoint. Validation: docs only; each state read from GitHub and the run reports on 2026-10-29; spotlessCheck and git diff --check pass.
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.
Summary
On master, every
Nibblemade the usual ways has the value 0:Nibble.of(9),Nibble.of('A'),0xA.toNibble(),'c'.isNibble()andnew Nibble(Array<Bit>:[1, 0, 0, 1])all give 0.Nibble.of(9).bitsfails with anIllegalStateException, andnew Nibble("7")fails with "OutOfBounds: numbers.Nibble overflow".Root cause
xConstrainedInteger, the native template of the fixed-width integers, handles aNibble's 4 bits as if they filled a byte:constructFromBits()reads the bits as the bytes they're packed in, from the most significant bit down. ANibble's bits are the high half of a byte, so[1, 0, 0, 1]reads as0x90, andNibble's mask then leaves 0.Nibblebuilds its table of values this way, andNibble.of(),IntLiteral.toNibble()andChar.isNibble()go through that table.bitsmakes an array off_cNumBits / 8bytes, which is none for aNibble.constructFromString(), which answersNibble(String), checks the value by its size in whole bytes, so everyNibbleoverflows.Change
constructFromBits()shifts out the unused low bits of the last byte.bitsputs the value in the high bits of its byte, asconstructFromBits()reads them.constructFromString()checks a value narrower than a byte against its range.Validation
Nibble.of(0..F)00to15Nibble.of('0'..'F')00to15new Nibble([1, 0, 0, 1])090xA.toNibble()010'c'.isNibble()012Nibble.of(9).bitsIllegalStateException0b1001new Nibble("7")OutOfBoundsoverflow7testNibble()inmanualTests'numbers.xasserts all of the above, plus that"16"overflows and that aNibble's bits make the sameNibbleagain. CI runs it with the other manual tests. With master'sxConstrainedInteger.javait fails at its first assert, and the run task fails with "Module 'TestNumbers' execution failed with exit code: 1".xdk:installDist:checkpasses, including the Ecstasy library tests (lib_json'sJsonTest175,lib_metrics'MetricsTest4);:javatools:testpasses 456 tests, the 42 existing skips;TestNumberspasses throughmanualTests:runOne;spotlessCheckpasses.toString()(Make toString() native for the integer types, Nibble, Char and String #722), whose test makes itsNibbles from anInt64because of this.Limits
Nibble(Byte[])still fails.Nibble's constructor asserts one byte, andNumber's turns it into 8 bits, whichNibble's bits constructor refuses. That's for the library to settle.