diff --git a/Cargo.toml b/Cargo.toml index aa8e63d..38e73ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,7 @@ tree-sitter-inference = "0.0.38" anyhow = "1.0.100" thiserror = "2.0.18" serde = { version = "1.0.228", features = ["derive", "rc"] } +cov-mark = "2.2.0" leb128 = "0.2.5" rustc-hash = "2.1.1" inkwell = { version = "0.8.0", features = ["llvm21-1"] } diff --git a/core/type-checker/Cargo.toml b/core/type-checker/Cargo.toml index dc41e17..9321f74 100644 --- a/core/type-checker/Cargo.toml +++ b/core/type-checker/Cargo.toml @@ -11,3 +11,4 @@ inference-ast.workspace = true anyhow.workspace = true thiserror.workspace = true rustc-hash.workspace = true +cov-mark.workspace = true diff --git a/core/type-checker/src/type_checker.rs b/core/type-checker/src/type_checker.rs index 82de1b2..9f7bee7 100644 --- a/core/type-checker/src/type_checker.rs +++ b/core/type-checker/src/type_checker.rs @@ -2092,8 +2092,10 @@ impl TypeChecker { }; if let Some(key) = key { if self.reported_error_keys.contains(&key) { + cov_mark::hit!(type_checker_error_dedup_skips_duplicate); return; } + cov_mark::hit!(type_checker_error_dedup_first_occurrence); self.reported_error_keys.insert(key); } self.errors.push(error); diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 47e3b0a..02fb9bd 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -10,6 +10,7 @@ repository = { workspace = true } anyhow.workspace = true serde_json = "1.0.99" wasmtime="40.0.0" +cov-mark.workspace = true inference-ast.workspace = true inference-wasm-codegen.workspace = true diff --git a/tests/src/type_checker/error_recovery.rs b/tests/src/type_checker/error_recovery.rs index 512cf47..cb17765 100644 --- a/tests/src/type_checker/error_recovery.rs +++ b/tests/src/type_checker/error_recovery.rs @@ -101,6 +101,7 @@ mod error_recovery_tests { return helper(10); } "#; + cov_mark::check!(type_checker_error_dedup_first_occurrence); let result = try_type_check(source); assert!( result.is_err(), @@ -125,14 +126,12 @@ mod error_recovery_tests { #[test] fn test_error_deduplication() { let source = r#" - struct Container { - value: UnknownType; - } - fn test(c: Container) -> UnknownType { - let x: UnknownType = c.value; - return x; + fn test(a: UnknownType, b: UnknownType) -> UnknownType { + let x: UnknownType = a; + return b; } "#; + cov_mark::check!(type_checker_error_dedup_skips_duplicate); let result = try_type_check(source); assert!( result.is_err(),