You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A make block inside an opt-in stdlib module is invisible to the type checker #229
KexiRegistry::buildSemanticInterfaces publishes receiverFunctions only for modules named in package.receiverProviders, and src/main.cxx sets that to the file-level prelude module alone. Every make block inside an opt-in stdlib module is therefore collected as a method but never reaches ImportedInterfaces::receiverFunctions.
Consequences, all reproducible today on net-redesign:
using Net.HTTP
main do
let s = Status.from(201).try
let bad: Integer = s.success? # accepted: `s.success?` types as Unknown
end
using Net.HTTP
main do
let client = Client.open().try
client.get("http://127.0.0.1:1/x") # runtime: Undefined method: get for Tuple
end
client.get is the sharp end. Because the checker cannot see make Client do foul get(url), the call binds to the prelude's get, and lowering then emits Kex.Net.HTTP:get/2 (the Headers arity) instead of the get/3 dispatcher that has a correct Net.HTTP.Client arm. client.request(...), client.statistics and client.close all work — they collide with no prelude receiver name, so the runtime tag dispatch resolves them.
Same shape for Net.IP: Address.parse("::1").try.string types as Unknown rather than String.
Two halves to fix, and they have to land together:
Publish opt-in modules' make methods as receiver functions (or find the narrower rule — every stdlib make method becoming a global receiver candidate is a large change in what overload resolution sees).
Resolve partially-qualified module paths at the call site. using Net.HTTP makes Status.from(…) legal, but only the full Net.HTTP.Status is a key in ImportedInterfaces::modules, so the call's result type comes back Unknown. An unrelated Status module is also registered, so the bare segment cannot simply be matched first.
Fixing (2) alone is a regression: with types known but make methods still unpublished, address.string starts reporting a false "expects argument 1 to be Char, but got Address" against the prelude's string overloads. I tried it and backed it out.
Attempted both halves. Neither ships alone, and the real blocker is one level down — recording the evidence and leaving this open.
Half 1, partial-path resolution alone (resolve Status/Client against the using prefix before looking either up): makes Client.open() and Status.from(…) type correctly, and immediately turns Address.parse("::1").try.string into a false error — string expects argument 1 to be Char, but got Address. The receiver's type stops being Unknown while make Address's methods are still unpublished, so the checker matches it against the prelude's string overloads and rejects it. Silence was load-bearing.
Half 2, publishing split stdlib modules as receiverProviders: this is what makes make methods visible, and on its own it publishes Kex.Http's get : String -> Result<Response<Binary>, NetError> as a global receiver candidate (Http is an automatic prelude import). response.headers.get("content-type") in spec/stdlib/net_http.spec.kex then fails to resolve. Note this also wants a dedup: the unit's ENTRY module is flattened and already carries every method its split modules declare, so publishing both makes uri.encode "provided by both 'Kex.URI' and 'kex_prelude'" — an ambiguity between one function and itself.
The actual blocker. Neither half reaches Net.HTTP at all, because Net.HTTP has no prebuilt module and therefore no KexI interface. src/main.cxx's prelude build filters opt-in sources to those sitting directly at the stdlib root:
so everything under src/stdlib/net/ and src/stdlib/kex/ is compiled from source on every run and never gets an interface. standardLibraryArtifactSourceFiles's own comment says this is deliberate ("Nested library modules remain independently loadable source dependencies"), so flipping it is a design decision, not a fix.
I tried lifting the filter to see the cost. The stdlib has never been analysed as a single unit, and six latent errors fall out immediately:
control/retry.kex — Control.Retry.run calls Task.sleep from a pure context (real bug: it sleeps, it is foul)
net/socket.kex — connect : TCP.Endpoint -> … inside module TLS does not resolve; needs the full Net.Socket.TCP.Endpoint
net/http.kex ×4 — Unknown type Server.Running for the handle operations written at the file's top level
units/si.kex ×4 — raw.abs / .floor ambiguous between make Float's method and Math.abs : Number -> Number
Those six are fixed on net-redesign (they are correct independently of this issue). Past them the prelude compiles and emits Kex.Net.HTTP.*, Kex.Net.IP.*, Kex.Net.Socket.* — and then codegen fails with kex_prelude: undefined function size/2 in 'Units.Data.terabytes'/1, so there is at least one more layer.
Suggested order: decide whether nested modules join the prebuilt artifact; if yes, land that plus the codegen tail first, then both halves above together with the dedup. Until then client.request(method, url, headers, body) is the working spelling for the pooled client — it collides with no prelude receiver name and reaches Client's own method. spec/net_http_roundtrip_beam.kex uses it and passes.
Activity
akoskovacs commentedon Aug 28, 2026
Attempted both halves. Neither ships alone, and the real blocker is one level down — recording the evidence and leaving this open.
Half 1, partial-path resolution alone (resolve
Status/Clientagainst theusingprefix before looking either up): makesClient.open()andStatus.from(…)type correctly, and immediately turnsAddress.parse("::1").try.stringinto a false error —stringexpects argument 1 to be Char, but got Address. The receiver's type stops being Unknown whilemake Address's methods are still unpublished, so the checker matches it against the prelude'sstringoverloads and rejects it. Silence was load-bearing.Half 2, publishing split stdlib modules as
receiverProviders: this is what makesmakemethods visible, and on its own it publishesKex.Http'sget : String -> Result<Response<Binary>, NetError>as a global receiver candidate (Http is an automatic prelude import).response.headers.get("content-type")inspec/stdlib/net_http.spec.kexthen fails to resolve. Note this also wants a dedup: the unit's ENTRY module is flattened and already carries every method its split modules declare, so publishing both makesuri.encode"provided by both 'Kex.URI' and 'kex_prelude'" — an ambiguity between one function and itself.The actual blocker. Neither half reaches
Net.HTTPat all, becauseNet.HTTPhas no prebuilt module and therefore no KexI interface.src/main.cxx's prelude build filters opt-in sources to those sitting directly at the stdlib root:optInFiles.erase(std::remove_if(optInFiles.begin(), optInFiles.end(), [&](const auto &file) { return std::filesystem::path(file).parent_path() != stdlibRoot; }), optInFiles.end());so everything under
src/stdlib/net/andsrc/stdlib/kex/is compiled from source on every run and never gets an interface.standardLibraryArtifactSourceFiles's own comment says this is deliberate ("Nested library modules remain independently loadable source dependencies"), so flipping it is a design decision, not a fix.I tried lifting the filter to see the cost. The stdlib has never been analysed as a single unit, and six latent errors fall out immediately:
control/retry.kex—Control.Retry.runcallsTask.sleepfrom a pure context (real bug: it sleeps, it is foul)net/socket.kex—connect : TCP.Endpoint -> …insidemodule TLSdoes not resolve; needs the fullNet.Socket.TCP.Endpointnet/http.kex×4 —Unknown type Server.Runningfor the handle operations written at the file's top levelunits/si.kex×4 —raw.abs/.floorambiguous betweenmake Float's method andMath.abs : Number -> NumberThose six are fixed on
net-redesign(they are correct independently of this issue). Past them the prelude compiles and emitsKex.Net.HTTP.*,Kex.Net.IP.*,Kex.Net.Socket.*— and then codegen fails withkex_prelude: undefined function size/2 in 'Units.Data.terabytes'/1, so there is at least one more layer.Suggested order: decide whether nested modules join the prebuilt artifact; if yes, land that plus the codegen tail first, then both halves above together with the dedup. Until then
client.request(method, url, headers, body)is the working spelling for the pooled client — it collides with no prelude receiver name and reaches Client's own method.spec/net_http_roundtrip_beam.kexuses it and passes.