Skip to content

Add type validation for signal handler and server shutdown statements #170

Description

@coderabbitai

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

Activity

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

Metadata

Metadata

Assignees

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