Skip to content

Conversation

@Arowolokehinde
Copy link

@Arowolokehinde Arowolokehinde commented Jan 23, 2026

Fixes #71
Fixes #108

Summary

Migrates the type checker's error deduplication system from string-based keys to more efficient node-ID based approach using FxHashSet<(ErrorKind, u32)>.

Changes

Added

  • ErrorKind enum in core/type-checker/src/errors.rs

    • Categorizes the 5 error types that require deduplication
    • UnknownType, UndefinedFunction, UnknownIdentifier, UndefinedStruct, UndefinedEnum
  • kind() method on TypeCheckError

    • Returns Option<ErrorKind> for errors that need deduplication
    • Returns None for other error types

Modified

  • TypeChecker struct (core/type-checker/src/type_checker.rs)

    • Changed field: reported_error_keys: FxHashSet<String>reported_errors: FxHashSet<(ErrorKind, u32)>
  • push_error_dedup signature

    • Now accepts node_id: u32 parameter
    • Uses (ErrorKind, u32) tuple as deduplication key
  • 7 call sites updated to pass node IDs:

    • Generic type base validation (line 443)
    • Generic type parameter validation (line 454)
    • Custom type validation (line 468)
    • Enum definition validation (line 963)
    • Function call validation (line 1203)
    • Struct expression validation (line 1305)
    • Identifier validation (line 1525)
  • 3 test expectations updated for new behavior:

    • test_error_deduplication_same_unknown_type_multiple_uses: 1 → 4 errors
    • test_error_deduplication_same_undefined_function_multiple_calls: 1 → 2 errors
    • test_error_deduplication_same_unknown_identifier_multiple_uses: 1 → 3 errors

Testing

  • ✅ All type-checker unit tests pass (71 tests)
  • ✅ Build succeeds: cargo build -p inference-type-checker
  • ✅ Test expectations updated to reflect new behavior
  • ✅ No breaking changes to public API (all changes are internal)

Files Modified

  • core/type-checker/src/errors.rs - Added ErrorKind enum and kind() method
  • core/type-checker/src/type_checker.rs - Updated deduplication logic and call sites
  • tests/src/type_checker/error_recovery.rs - Updated test expectations
  • implemenration.md - Added implementation documentation

cargo build -p inference-type-checker
cargo test -p inference-type-checker


Changes

Added

  • ErrorKind enum - Categorizes 5 error types needing deduplication
  • kind() method on TypeCheckError - Returns error category

Modified

  • TypeChecker field: FxHashSet<String>FxHashSet<(ErrorKind, u32)>
  • push_error_dedup now accepts node_id: u32 parameter
  • 7 call sites updated to pass node IDs
  • 3 test expectations updated for new behavior

EOF

@Arowolokehinde Arowolokehinde changed the title Migrate error deduplication to node-ID based approach Migrate error deduplication to node-ID based approach, Fixes #71 Jan 23, 2026
@Arowolokehinde Arowolokehinde changed the title Migrate error deduplication to node-ID based approach, Fixes #71 Migrate error deduplication to node-ID based approach, fixes #71 Jan 23, 2026
@Arowolokehinde
Copy link
Author

@0xGeorgii can you kindly review my pr

1 similar comment
@Arowolokehinde
Copy link
Author

@0xGeorgii can you kindly review my pr

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node-ID-Based Error Deduplication

1 participant