Skip to content

Commit f046969

Browse files
committed
Fix process sequential part labels added to wrong scope
1 parent 8bfc566 commit f046969

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

vhdl_lang/src/analysis/concurrent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a> AnalyzeContext<'a> {
121121
}
122122
}
123123
let nested = scope.nested();
124-
self.define_labels_for_sequential_part(scope, parent, statements, diagnostics)?;
124+
self.define_labels_for_sequential_part(&nested, parent, statements, diagnostics)?;
125125
self.analyze_declarative_part(&nested, parent, decl, diagnostics)?;
126126
self.analyze_sequential_part(&nested, parent, statements, diagnostics)?;
127127
}

vhdl_lang/src/analysis/tests/homographs.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,3 +1030,31 @@ end architecture;
10301030
.related(code.s("homo1", 1), "Previously defined here")],
10311031
);
10321032
}
1033+
1034+
// This was a bug at one point
1035+
#[test]
1036+
fn same_label_in_different_process_is_not_homograph() {
1037+
check_code_with_no_diagnostics(
1038+
"
1039+
entity ent is
1040+
end entity;
1041+
1042+
architecture a of ent is
1043+
begin
1044+
process
1045+
begin
1046+
l0 : loop
1047+
end loop;
1048+
wait;
1049+
end process;
1050+
1051+
process
1052+
begin
1053+
l0 : loop
1054+
end loop;
1055+
wait;
1056+
end process;
1057+
end architecture;
1058+
",
1059+
);
1060+
}

0 commit comments

Comments
 (0)