From 4dc5ba6de53eb962dc294afa331f381f55674baf Mon Sep 17 00:00:00 2001 From: dalance Date: Tue, 1 Aug 2023 11:11:15 +0900 Subject: [PATCH] Add hierarchical identifier check --- .../analyzer/src/handlers/create_reference.rs | 17 ++++++++--------- testcases/sv/11_let.sv | 5 ++--- testcases/vl/11_let.vl | 5 ++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/crates/analyzer/src/handlers/create_reference.rs b/crates/analyzer/src/handlers/create_reference.rs index ccae59b0..0ecd43c9 100644 --- a/crates/analyzer/src/handlers/create_reference.rs +++ b/crates/analyzer/src/handlers/create_reference.rs @@ -40,19 +40,18 @@ impl<'a> VerylGrammarTrait for CreateReference<'a> { } } else { let is_single_identifier = SymbolPath::from(arg).as_slice().len() == 1; - if is_single_identifier { - let name = arg.identifier.identifier_token.text(); - if name != "_" { - self.errors.push(AnalyzerError::undefined_identifier( - &name, - self.text, - &arg.identifier.identifier_token, - )); - } + let name = arg.identifier.identifier_token.text(); + if name != "_" || !is_single_identifier { + self.errors.push(AnalyzerError::undefined_identifier( + &name, + self.text, + &arg.identifier.identifier_token, + )); } } } Err(err) => { + // TODO check SV-side member to suppress error let name = format!("{}", err.last_found.token.text); let member = format!("{}", err.not_found); self.errors.push(AnalyzerError::unknown_member( diff --git a/testcases/sv/11_let.sv b/testcases/sv/11_let.sv index e92d01ed..deecdbe6 100644 --- a/testcases/sv/11_let.sv +++ b/testcases/sv/11_let.sv @@ -9,7 +9,6 @@ module veryl_testcase_Module11; assign _c = 1; // assign declaration - assign b = 1; - assign bb = 1; - assign aa.a = 1; + assign b = 1; + assign bb = 1; endmodule diff --git a/testcases/vl/11_let.vl b/testcases/vl/11_let.vl index 338afa37..1c012542 100644 --- a/testcases/vl/11_let.vl +++ b/testcases/vl/11_let.vl @@ -8,7 +8,6 @@ module Module11 { var _c: logic<10> = 1; // assign declaration - assign b = 1; - assign bb = 1; - assign aa.a = 1; + assign b = 1; + assign bb = 1; }