fix(debugger): name an unsupported construct of a unit program, cover a list constant #377
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/370-debug-list-constant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #370
Task
Loop item torbscript/language#370: a unit test that runs a program with a list constant through the debug-lowered VM path fails with the internal error "the VM reached code the IR says nothing reaches". Item access (
xs[i]) in breakpoint conditions was therefore not covered by a unit test (found in #37 / PR #367).Root cause
Not a VM or IR bug. The compiler tests lower programs against the stub prelude of
compiler/tests/harness.trb, which deliberately has noiterateon itsArrayList. A list literal typed as the traitList<Item>needs a witness table, and the witness foriteratecannot be built without a body or a natives-manifest row. The lowering then reports the construct as unsupported (lowering.unsupported) and replaces the entry function with anunreachablestub.debuggedOfignored that finding, so the VM ran into the stub and died with the nameless internal error.Existing tests pin that a list literal is unsupported in the stub prelude (e.g.
lower.test.trb"a list literal says which construct it is"), so the prelude is left alone.Change (tests only,
compiler/tests/debugger.test.trb)debuggedOfnow panics with the unsupported construct and its position instead of running the stub, so this can no longer surface as a VM internal error. The unit program annotatesArrayList<Int>, which lowers without boxing.[numbers = [10, 20, 30], total = 40]; a breakpoint condition reads items of the list (numbers[1] == 20,numbers[0] < numbers[1], ...).The condition grammar only takes literal item indices (
names[2]), no variable index, so the conditions use literal positions.Nothing under
seed/,tools/, the natives manifest or the runtime is touched.Test
torb format --check compiler/tests/debugger.test.trb: clean.tools/check-commits.sh origin/main HEAD: clean.0a97be00: all jobs green (bootstrap, tier A, tier B, gates, commit messages).452a104f6f7d1c32fe807d1c32fe80de0ff1c0fbde0ff1c0fb89b75d96fe89b75d96fe5a7e2e3dc5055f28dd71092fad9881092fad988117a28ce7b117a28ce7b1b3e0d6b254b3e0d6b254d53c6f8ac6d53c6f8ac68d091d6a9a8d091d6a9a2cdb3b6d1d2cdb3b6d1d0a97be00ecWIP: fix(vm): a list constant in a debug-lowered unit runto fix(debugger): name an unsupported construct of a unit program, cover a list constantChecklist (head
0a97be00):iterateonArrayList, so the lowering reportslowering.unsupportedand stubs the entry) matches the code;debuggedOfnow panics with the construct and position instead of running the stub. Reproduction commit precedes the fix, as the issue asks.seed/).Non-blocking: none.