v3.4.0 #54
minirang
announced in
Announcements
v3.4.0
#54
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Description
Fixed: an incomplete statement was reported on the line after it. A statement that stopped early (
set number x tofollowed by another line) pointed the caret at the next statement, and a block with noendpointed at an empty line past the end of the file. Errors now sit on the statement's own line, at the point where it ends, and a missingendsays where the block was opened.Fixed: errors from imported files were drawn from the wrong file. An error inside a module's function or top-level code used the module's line and column but showed the importing file's line, and an error in a function declared by an earlier
cuffshentry showed the current entry. An error now carries the text it points into, so the report shows the right line and names the file (Runtime Error in './lib/ratio.cuff' at line 3). A module that fails to parse (E5-002) shows theusestatement and then the module's own line and column.Fixed: an error inside an f-string's braces pointed at the start of the f-string. In
print(f"fib(10) = {fib(10)}")a failing call put the caret under thef, because everything in the braces was placed at the literal's location. The error is now reported at the call itself, also after escapes such as\tor\", after Korean text, and when the literal runs over several lines.Behavior change: columns count characters, and the caret follows display width.
columnused to count bytes, so a Korean string earlier on a line made the headline disagree with the caret. It now counts characters. The caret copies tabs and gives wide characters two columns, so it lines up in a terminal. Offsets are still bytes.Fixed: a UTF-8 byte order mark at the start of a file was rejected by
cuffc. The engine now ignores it, as the shell already did.Behavior change: text left over inside an f-string's braces is an error.
f"{n 2}"used to evaluatenand silently ignore2; it is nowE2-001, and errors in an f-string expression name the expression.Fixed: a program the parser accepts could still fail, or crash a small thread. A chain of operators, indexes or slices just under the expression limit failed with
E4-017because evaluating it used stack in proportion to its length. Such chains are now evaluated iteratively, and a long expression tree is freed iteratively too (it overflowed a 256 KiB stack when it was merely destroyed). A stack budget configured larger than the thread's real stack used to turn runaway recursion into a crash; it is now reduced to the stack that exists. The relationships between limits are checked at compile time (static_asserts inLimits.h) and covered by new tests.Fixed: one
Sessionper thread was a data race. The table of identifier names shared by all threads was unsynchronised; it is now locked. A thread-safety test runs under ThreadSanitizer in the documented setup.Fixed: the Windows build failed with MinGW-w64 from MSYS2.
GetCurrentThreadStackLimitsis a Windows 8 function that headers declare only for a newer_WIN32_WINNTthan this project targets, soAttributes.hdid not compile there (older MinGW headers let it through). It is now looked up when first needed, which works with any header and on a Windows without it, where the engine uses its default stack budget.Fixed: two shell tests failed on macOS. The test harness took a closed pseudo-terminal to mean "still running" because macOS reports it as end-of-file where Linux raises an error, and the fuzzer wrote to a shell that had already exited (macOS refuses such a write). Both are handled; the shell itself did not change.
Fixed: calls queued by
asyncsurvived an error. When a queued call failed, the calls still waiting ran at the nextcuffshentry. The queue is now emptied when an error ends a run.Behavior change:
cuffcrejects unknown options and more than one script. An unrecognised option used to be taken as the script's file name.--helpnow writes to standard output, and a file is read as bytes on every platform (a text-mode read on Windows changed line endings and stopped at a Ctrl+Z byte).The shell follows the engine.
cuffshno longer parses, runs or formats errors itself: it hands each entry tocuff::Sessionand prints the finished report, so its output is the same ascuffc's by construction.CuffEngine::Optionsis now the interpreter's own configuration, and both programs read the engine's command-line flags through one function (EngineOptionsCli.h). API change:CuffEngine::executeno longer returns the syntax tree it ran.Clearer syntax messages. Messages say
end of lineandend of fileinstead of a quoted'\n'or''.Faster reading of large programs. The token list is reserved up front (about 9% faster tokenizing of a 3 MB program), and
cuffchands its source to the engine instead of copying it.Documentation is organised and checked.
docs/is nowguide/,reference/,internals/andcontributing/, with a page for every library,cuffc,cuffsh, the built-in functions, the error catalogue, the limits and the architecture. Limits, error codes, the function index and the command-line help are generated from the code (python3 tools/docs.py generate), andpython3 tools/docs.py checkverifies links, library coverage, the version and that every runnable example prints what the page says.SPEC.md,REGEX.md,IMPLEMENTATION_NOTES.mdandEXTENDING.mdmoved todocs/reference/language.md,docs/reference/patterns.md,docs/internals/design-notes.mdanddocs/contributing/extending.md.Tests and workflows. New unit tests for error locations, limits, and threads.
cli/tests/requirements.txtlists the shell tests' Python packages. The shell workflow sets up a pinned Python instead of--break-system-packages, buildscuffcso thecuffsh-versus-cuffccomparison actually runs, prints tool versions, and also runs when the engine changes.run_tests.ps1expected the old four-digit error codes and its-TimeScaleoption never reached the tests; both work now. Unit tests link with-pthread.All reactions