Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
1 change: 1 addition & 0 deletions core/type-checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ inference-ast.workspace = true
anyhow.workspace = true
thiserror.workspace = true
rustc-hash.workspace = true
cov-mark.workspace = true
2 changes: 2 additions & 0 deletions core/type-checker/src/type_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions tests/src/type_checker/error_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ mod error_recovery_tests {
}
"#;
let result = try_type_check(source);
cov_mark::check!(type_checker_error_dedup_first_occurrence);
assert!(
result.is_err(),
"Type checker should report unknown type error"
Expand All @@ -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);
Comment on lines +134 to 135
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cov_mark::check! call is placed before the code that should trigger the coverage mark. This will verify the mark was hit in a previous test run rather than during this specific test execution. Move the check after try_type_check(source) to properly verify the mark is hit during this test.

Copilot uses AI. Check for mistakes.
assert!(
result.is_err(),
Expand Down