Repository navigation
fix: keep exports of a required module listed before its dependent - #11
Merged
Merged
Conversation
bananaplain
force-pushed
the
fix/keep-exports-of-repeated-required-modules
branch
from
October 12, 2026 09:21
8b8d81f to
188f019
Compare
Since 0.1.1 every required module is validated inside the parse of the top module. A module already processed as an earlier entry of the same requires list is skipped, as in codeplain, but the skip also dropped its exported definitions, so a dependent listed after it failed with "Concept ... is not defined". codeplain never saw this because it parses each required module fresh. The skip now re-adds the module's own exports.
Diamonds and independent branches must fail with the fixed-order error. Two valid chains the parser still rejects are tests expected to fail.
The four tests around Top requiring [Base, Middle] with Middle requiring Base now say which module is parsed and what it must see, and the two new ones cover the case the fix newly rejects (Middle redefining an export of Base) and a Base that exports nothing. The rejection tests now assert PlainSyntaxError, and the topology cases live in named constants so each group says what it is before its cases.
bananaplain
force-pushed
the
fix/keep-exports-of-repeated-required-modules
branch
from
October 12, 2026 10:03
188f019 to
0201607
Compare
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.
A module whose requires lists an ancestor and then a module that itself requires that ancestor (
requires: [a, b], withbrequiringa) failed to parse whenbuses a concept exported bya:process_required_modulesskipsathe second time it is reached, so it isn't processed twice. That skip also droppeda's exported definitions, sobwas validated without them. Every module abovebin the chain failed with the same error.The skip comes from codeplain, where it is harmless: codeplain validates each required module in a separate, fresh parse, where
bprocessesaitself. Since 0.1.1, plain-parser validates required modules inside the top module's parse, so thatplain-parser checkmatches--dry-runwhile reading each file once. In that shared walk, the skip losesa's exports.Change
bno longer fails first:requires: [b, c, b], andrequires: [base, left, right]withleftandrightboth requiringbase. That is the messagecodeplaingives.bdefining a concept with the same name as oneaexports, with different text, fails with "Concepts were defined multiple times".tests/data/requires/shared_export_{base,middle,top,above}.plaincover the module that requires both (top) and a module above it (above).Verification
plain-parser checkacross 3,725 example and corpus.plainfiles: compared with 0.1.2, the only changes are three existing modules with this requires shape, which go from failing to OK, plus the new fixtures.Release
plain-forgeusers on 0.1.2 needuv tool upgrade plain-parser;plain-forge updatedoes not upgrade it.