Skip to content

Commit

Permalink
Add hierarchical identifier check
Browse files Browse the repository at this point in the history
  • Loading branch information
dalance committed Aug 1, 2023
1 parent dddd628 commit 4dc5ba6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
17 changes: 8 additions & 9 deletions crates/analyzer/src/handlers/create_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 2 additions & 3 deletions testcases/sv/11_let.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions testcases/vl/11_let.vl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 4dc5ba6

Please sign in to comment.