Dotted / namespace unit names in uses
- Type: feature (Track A compiler / unit resolver)
- Status: done
- Owner: Track A
- Opened: 2026-06-21 (Synapse POSIX profile smoke)
- Relation: unblocks
feature-networking/ Synapse Delphi-Posix.*path; companion tofeature-dynamic-include-paths-config
Problem
PXX currently treats a dotted uses entry as only its first identifier. Synapse's
Delphi-POSIX path uses units such as:
Posix.SysSocketPosix.SysSelectPosix.SysTimePosix.NetinetInPosix.StrOptsPosix.Errno- later:
Posix.Base,Posix.Unistd,Posix.ArpaInet,Posix.NetDB System.Generics.Collections,System.Generics.Defaultsinblcksock
With the manual Synapse POSIX profile (SYNAPSE_PROFILE=posix), the pinned
stable compiler fails before any Posix.* shim can be tested:
pascal26:2316: error: uses: unit source not found: posix ()
That is a compiler resolver/parser gap, not a library workaround target.
Required behavior
- Parse the full dotted name in a
usesclause as one logical unit name. - Preserve the dotted name for qualified references such as
Posix.SysSocket.SocketandSystem.Generics.Collections. - Define and document the source-file lookup rule for dotted units. A practical
implementation should support at least one stable mapping from search roots,
for example
Posix/SysSocket.pasand/orPosix.SysSocket.pas. - Keep existing non-dotted unit lookup behavior unchanged.
Non-goals
- Do not add Synapse-specific path hacks.
- Do not require PAL/network code to flatten names into fake units such as
posixsyssocket. - Do not implement the
Posix.*socket shims in this compiler ticket.
Acceptance
- A focused test with
uses Posix.SysSocket;resolves a local stub unit and can reference an exported symbol throughPosix.SysSocket.SymbolName. - A focused test with
uses System.Generics.Collections;resolves the full dotted unit name rather than looking for onlysystem. - Re-running
SYNAPSE_PROFILE=posix test/manual/try_synapse_compile.shno longer reportsuses: unit source not found: posixoruses: unit source not found: systemfor failures caused by dotted-name truncation.
Log
- 2026-06-21 — filed from Track B Synapse smoke. The PAL/network layer already has socket primitives; Synapse's Delphi-POSIX path now needs compiler support for real Delphi namespace unit names before library shims can be useful.
- 2026-06-21 — DONE (commit 73b5b3a). Three parser changes (parser.inc):
ReadDottedUsesNamereadsident('.'ident)*in everyusesclause (program / unit interface / unit implementation) and in theunit X.Y;header, so the full dotted name reaches the resolver.ParseUsesUnitalready looks up the lowercased name in each search root, so a 2-partPosix.SysSocketmaps toposix.syssocket.pas— the stable flat-filename mapping — with no resolver change.ConsumeUnitQualifierrewritten to match the LONGEST dotted compiled-unit prefix that still leaves a trailing.member, soPosix.SysSocket.SymbolresolvesPosix.SysSocketas the unit (notPosix), leaving the parser onSymbol. Non-dottedUnit.Memberandrecord.fieldare unchanged (it consumes nothing unless the prefix is a compiled unit).unit Posix.SysSocket;headers accepted (dotted name read; symbols still registered underCurrentUnitIdx= the interned dotted name).
- Acceptance 1 (
uses Posix.SysSocket;+Posix.SysSocket.AF_INET/.SockTag): PASS. Acceptance 2 (uses System.Generics.Collections;): PASS (3-part unit resolves; itsListTagcallable). Regression testtest/dotted/test_dotted_uses.pas(+ stub unitsposix.syssocket.pas,system.generics.collections.pas) inmake test-core, prints2/42/7. - Acceptance 3 (Synapse smoke): PASS — truncated
unit source not found: posix/systemerrors gone. Synapse now advances to full-dotted misses (posix.base,system.ansistrings) = the library/shim work (out of scope per non-goals), proving dotted-name resolution works end to end. - File mapping is flat (
Posix.SysSocket→posix.syssocket.pas, lowercased); aPosix/SysSocket.passubdir mapping was not added (the ticket asked for "at least one stable mapping"). Gate green: self-host + threadsafe byte-identical.