Repository navigation
fix: lib/stdlib/posix.flow and net.flow never parsed - #549
Conversation
Both declare externs as `extern function open(...)`. The language wants a
braced block, `extern { function open(...) }`, which is what every other
stdlib module uses. Neither file has ever been parseable, so any program
importing them failed:
lib/stdlib/posix.flow Expected TokenType.LBRACE, got TokenType.FUNCTION
at line 49
lib/stdlib/net.flow same, at line 51
29 declarations in posix.flow and 15 in net.flow, now wrapped.
Nothing caught this because tier-2 compiles tests/ and examples/, and no
file in either imports posix or net. The documentation example checker found
it: three tutorials in docs/tutorials/advanced.md import stdlib/posix.flow
and were being reported as broken documentation when the fault was in the
library they import.
Also tags 17 examples whose imports are illustrative rather than real:
catalogues of import forms in the spec and the module system reference,
relative-import syntax where the sibling is hypothetical, `flowlm` and
`hello_lib` package examples, and `mylib` in the beginner tutorial. One
block in modules.md shows two imports annotated `# forbidden`, so it is
tagged expect-error rather than ignored, and it does fail.
Examples: verified 407 to 423, unverified 300 to 267. The imports and clang
failure stages are now empty; what remains is parse 202, types 39,
vacuous 26.
Unit 1496 passed, tier-2 677/677, coverage and links clean.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Correcting an overstatement in this PR's description, now that it has merged. I wrote that fixing the two modules "verified 16 examples" and moved the count from 407 to 423. That is wrong. I measured it by calling What actually happened is narrower, and still worth having: the 20 blocks that were failing at the The accurate before and after: The |
The documentation example checker found a bug in the standard library.
Two shipped modules that have never parsed
Both declare externs unbraced:
The language wants a block, which is what every other stdlib module uses:
29 declarations in
posix.flow, 15 innet.flow. Any program importing either module fails immediately. I swept all 138 library modules; these two are the only ones affected.Why nothing caught it
./flow test --tier2compilestests/andexamples/, and no file in either importsposixornet. So a module can be shipped, listed in the generated API page, and be unusable, without any suite noticing.It surfaced because three tutorials in
docs/tutorials/advanced.mddoimport "stdlib/posix.flow", and the example checker was reporting them as broken documentation when the fault was in the library they import. Fixing the library verified 16 examples across several pages.Also in here: 17 illustrative imports
Imports that are meant to be hypothetical, now tagged with reasons rather than sitting in the ledger as anonymous debt:
LANGUAGE_SPEC.md,AI_FLOW_HANDBOOK.mdandlanguage/modules.md(import std.math { sin, cos }besideimport verify.nat as nat)flowlmandhello_lib, registry packages not vendored heremylibin the beginner tutorial, which the lesson has the reader createOne block in
modules.mdshows two imports annotated# forbidden. That is taggedexpect-errorrather than ignored, and it does fail, so the page now demonstrates the rule instead of asserting it.Count
The
importsandclangfailure stages are empty. What remains is parse 202, types 39, vacuous 26.Validation
./flow test --tier2 --strict677/677, which covers thelib/stdlibeditcheck_doc_coverage.pyandcheck_doc_links.pyclean--check-ledgerreports no new unverified examples