✓
Passing This code compiles and runs correctly.
Code
// Test 836: Complex multi-module flow with directory imports
//
// Tests realistic HTTP server pattern using multiple modules from same package
// Demonstrates: net.tcp:server.listen() → net.tcp:connection.read() → net.http:request.parse()
const std = @import("std");
~import "$app/lib/net"
// HTTP server flow using multiple modules from 'net' package
~app.lib.net.tcp:server.listen(port: 8080)
| listening l |> app.lib.net.tcp:server.accept(server_id: l.server_id)
| connection c |> app.lib.net.tcp:connection.read(conn_id: c.conn_id)
| data d |> app.lib.net.http:request.parse(bytes: d.bytes)
| request |> app.lib.net.http:response.build(status: 200, body: "OK")
| response resp |> app.lib.net.tcp:connection.write(conn_id: c.conn_id, data: resp.bytes)
| sent |> _
| failed |> _
| invalid |> app.lib.net.http:response.build(status: 400, body: "Bad Request")
| response resp |> app.lib.net.tcp:connection.write(conn_id: c.conn_id, data: resp.bytes)
| sent |> _
| failed |> _
| closed |> _
| failed |> _
| failed |> _
| failed |> _
Imported Files
// HTTP protocol module
const std = @import("std");
~pub event request.parse { bytes: []const u8 }
| request { method: []const u8, path: []const u8 }
| invalid { msg: []const u8 }
~pub event response.build { status: i32, body: []const u8 }
| response { bytes: []const u8 }
~proc request.parse {
return .{ .@"request" = .{ .method = "GET", .path = "/" } };
}
~proc response.build {
return .{ .@"response" = .{ .bytes = "HTTP/1.1 200 OK" } };
}
// TCP networking module
const std = @import("std");
~pub event server.listen { port: i32 }
| listening { server_id: i32 }
| failed { msg: []const u8 }
~pub event server.accept { server_id: i32 }
| connection { conn_id: i32 }
| failed { msg: []const u8 }
~pub event connection.read { conn_id: i32 }
| data { bytes: []const u8 }
| closed {}
| failed { msg: []const u8 }
~pub event connection.write { conn_id: i32, data: []const u8 }
| sent { bytes_written: i32 }
| failed { msg: []const u8 }
~proc server.listen {
return .{ .@"listening" = .{ .server_id = 1 } };
}
~proc server.accept {
return .{ .@"connection" = .{ .conn_id = 100 } };
}
~proc connection.read {
return .{ .@"data" = .{ .bytes = "GET / HTTP/1.1" } };
}
~proc connection.write {
return .{ .@"sent" = .{ .bytes_written = 100 } };
}
Test Configuration
Expected Behavior:
BACKEND_COMPILE_ERROR