Description
The type checker currently lacks proper validation for signal handler registration and server shutdown statements in src/typechecker/mod.rs (lines 1356-1381).
Missing Validations
RegisterSignalHandlerStatement
- Should validate
signal_type string against supported signal types (SIGINT, SIGTERM, etc.)
- Should ensure
handler_name refers to a defined handler with correct signature
StopAcceptingConnectionsStatement & CloseServerStatement
- Should validate that
server expression resolves to a Server type
- Should error if server type is incompatible (unless Unknown/Error for graceful degradation)
Current State
All three statement types currently accept any input without validation:
// TODO: Add type checking for signal handler registration
// For now, just accept any signal type and handler name
// TODO: Add type checking for server expression
// For now, just accept any type
Suggested Implementation
- Add
infer_expression_type(server) calls and type compatibility checks
- Validate signal type strings against known signal constants
- Ensure handler names resolve to callable actions with appropriate signatures
Impact
- Improved compile-time error detection
- Better developer experience with clear type mismatch messages
- Prevents runtime errors from invalid signal/server references
References
Description
The type checker currently lacks proper validation for signal handler registration and server shutdown statements in
src/typechecker/mod.rs(lines 1356-1381).Missing Validations
RegisterSignalHandlerStatement
signal_typestring against supported signal types (SIGINT, SIGTERM, etc.)handler_namerefers to a defined handler with correct signatureStopAcceptingConnectionsStatement & CloseServerStatement
serverexpression resolves to a Server typeCurrent State
All three statement types currently accept any input without validation:
Suggested Implementation
infer_expression_type(server)calls and type compatibility checksImpact
References