Skip to content
Closed
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
11 changes: 11 additions & 0 deletions compiler/semantic/tests/semantic_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ fn test_semantic_shadowing_warning() {
assert!(matches!(diags[0].code, ErrorCode::W0010));
}

#[test]
fn test_semantic_shadowing_multiple_levels() {
let (res, diags) = check_source("make x = 10\n{\n make y = 20\n {\n make x = 30\n }\n}");
assert!(res.is_ok()); // Shadowing is allowed, so compile succeeds
assert!(!diags.is_empty());

// We should find W0010 among the diagnostics
let has_shadow_warning = diags.iter().any(|d| d.level == DiagnosticLevel::Warning && matches!(d.code, ErrorCode::W0010));
assert!(has_shadow_warning, "Expected W0010 shadowing warning, but diagnostics were: {:?}", diags);
}

#[test]
fn test_semantic_constant_reassignment() {
let (res, diags) = check_source("const x = 10\nx = 20");
Expand Down
Loading