Skip to content

test/lexer and test/parser are not wired into any build.w test target #563

Closed

Description

@ehartford

Problem

Same shape as #559, found during its investigation: test/lexer/ (7 tests) and test/parser/ (11 tests) are referenced by no build.w target, so they never run under with build :test.

Sampled current state:

  • test/parser/ast_basic_decls.w passes today.
  • test/lexer/lexer_keywords_test.w fails under the new pub-visibility enforcement (0c06fbd4): 'Lexer' is private to module 'src/Lexer.w', 'TokenKind' private to 'src/Token.w'.

The exclusion dates to d5ec2f11 ("Reorganize test directory"), which kept lexer/parser/internals out of the default run citing "known codegen bugs with compiler internal APIs". That reason is stale — the harness path works (proven by test/internals/conan_recipe_link_metadata_test.w and the passing parser test); the failures today are visibility, the same disease #559 documents for src/compiler/foundation/*.w.

Proposed fix

Same pattern as the #559 fix: add pub to the consumed surface of src/Lexer.w / src/Token.w (and whatever else these tests import), fix or remove any genuinely stale tests, then add lexer-tests and parser-tests Test targets (or fold both globs into one target) wired into the test group, following the internals-tests shape.

Found while investigating #559.

Activity

  1. ehartford commented on Jun 12, 2026

    @ehartford
    ContributorAuthor

    Investigation results (against 89ad31a) — full inventory, and the fix is already proven green file-by-file in a temp tree.

    Status: 7/7 lexer tests fail (visibility: Lexer, TokenKind private), parser is mixed — 7 pass (pure-syntax fixtures), parser_unit_test.w fails on visibility (AstPool + friends), ast_expr_forms.w fails on its own drift (match arms written ->; grammar is =>).

    Minimal pub surface — 10 declarations, empirically validated: the enforcement gates only directly-named top-level symbols; methods and fields of a pub type are reachable without their own pub. So: type Lexer (Lexer.w:71), enum TokenKind (Token.w:10), type Parser (Parser.w:15), type AstPool (Ast.w:462), enum NodeKind (Ast.w:20), enum BinaryOp (Ast.w:313), const TYPE_TRAIT_OBJECT_DYN/IMPL (Ast.w:252-253), type InternPool (InternPool.w:81), type DiagnosticList (Diagnostic.w:102). No fn pubs needed, so #559's explicit-return-type constraint doesn't bite.

    API drift to fix in the same change (all verified):

    1. Tests use TokenKind.TK_EOF() paren-call style — passes check but fails codegen ("aggregate rvalue missing destination struct type"). Fix: strip parens. The sema-accepts/codegen-rejects mismatch itself is filed as Enum variant referenced with call parens (Color.Red()) passes with check but fails codegen #566.
    2. lexer_fuzz_smoke_test.w:7-8 chains a mut-self method on an rvalue — now correctly rejected (§15.3); bind var l = Lexer.init(...) first.
    3. parser_unit_test.w:150,152 — NK_TRAIT_DECL extra layout grew a 2-slot [trait_tp_count, trait_tp_start] prefix (Parser.w:2649-2651); shift offsets by 2.
    4. ast_expr_forms.w:3-4 — -> → =>.
    5. Stale bootstrap-era relics (coverage_manifest.txt, token_corpus.txt, ast_corpus.txt) reference dead paths; nothing uses them — delete in the same change.

    Fix shape (one logical change, mirrors ef5c106): two Test targets lexer-tests / parser-tests after the internals-tests block (build.w:849-853), wired into the test group (~build.w:955), + the 10 pub markers + the 4 drift fixes. src/ changes ride the bootstrap chain, so full build/fixpoint/test gauntlet applies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions