diff --git a/vhdl_lang/src/analysis/concurrent.rs b/vhdl_lang/src/analysis/concurrent.rs index d22fd771..e9de2ac1 100644 --- a/vhdl_lang/src/analysis/concurrent.rs +++ b/vhdl_lang/src/analysis/concurrent.rs @@ -96,7 +96,7 @@ impl<'a> AnalyzeContext<'a> { } self.define_labels_for_concurrent_part( - scope, + &nested, parent, &mut block.statements, diagnostics, diff --git a/vhdl_lang/src/analysis/formal_region.rs b/vhdl_lang/src/analysis/formal_region.rs index 25cb1942..df6c29d0 100644 --- a/vhdl_lang/src/analysis/formal_region.rs +++ b/vhdl_lang/src/analysis/formal_region.rs @@ -266,6 +266,8 @@ impl<'a> std::ops::Deref for GpkgInterfaceEnt<'a> { GpkgInterfaceEnt::Type(typ) => typ.deref(), GpkgInterfaceEnt::Constant(obj) => obj.deref(), GpkgInterfaceEnt::Subprogram(subp) => subp.deref(), + // `ent` is of type `&&AnyEnt`. `deref()` returns `&AnyEnt` which is what we want + #[allow(suspicious_double_ref_op)] GpkgInterfaceEnt::Package(ent) => ent.deref(), } } diff --git a/vhdl_lang/src/analysis/tests/homographs.rs b/vhdl_lang/src/analysis/tests/homographs.rs index 4767c17b..9dcfefd1 100644 --- a/vhdl_lang/src/analysis/tests/homographs.rs +++ b/vhdl_lang/src/analysis/tests/homographs.rs @@ -24,6 +24,36 @@ end package; check_no_diagnostics(&diagnostics); } +#[test] +fn allow_homographs_in_separate_blocks() { + let mut builder = LibraryBuilder::new(); + builder.code( + "libname", + " +entity A is +end A; + +architecture arch of A is + component Z is end component; +begin + + First : block + begin + Z_inst : Z; + end block; + + Second : block + begin + Z_inst : Z; + end block; +end arch; +", + ); + + let diagnostics = builder.analyze(); + check_no_diagnostics(&diagnostics); +} + #[test] fn forbid_homographs() { let mut builder = LibraryBuilder::new();