Skip to content

Commit

Permalink
Merge pull request #1130 from taichi-ishitani/fix_panic_on_check_ver_ref
Browse files Browse the repository at this point in the history
Fix panic on `check_var_ref` checker
  • Loading branch information
dalance authored Dec 9, 2024
2 parents ec030bd + 74a22eb commit b3cc767
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/analyzer/src/handlers/check_var_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,9 @@ impl VerylGrammarTrait for CheckVarRef<'_> {
Direction::Output => ExpressionTargetType::OutputPort,
Direction::Inout => ExpressionTargetType::InoutPort,
Direction::Ref => ExpressionTargetType::RefPort,
_ => unreachable!(),
_ => return Ok(()),
},
_ => {
return Ok(());
}
_ => return Ok(()),
};
self.add_expression(&path, r#type);
}
Expand Down
20 changes: 20 additions & 0 deletions crates/analyzer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,26 @@ fn invalid_factor_kind() {

let errors = analyze(code);
assert!(matches!(errors[0], AnalyzerError::InvalidFactor { .. }));

let code = r#"
interface InterfaceA {
var a: logic;
modport master {
a: input,
}
}
module ModuleA (
b: modport InterfaceA::master,
) {
var a: logic;
always_comb {
a = b;
}
}
"#;

let errors = analyze(code);
assert!(matches!(errors[0], AnalyzerError::InvalidFactor { .. }));
}

#[test]
Expand Down

0 comments on commit b3cc767

Please sign in to comment.