Skip to content

Commit 2c4b416

Browse files
authored
Merge pull request #3128 from taichi-ishitani/fix_undefined_identifier
unalias base path of rust style import
2 parents 08d7ec6 + 75778b4 commit 2c4b416

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

crates/analyzer/src/reference_table.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ impl ReferenceTable {
811811
self.check_complex_identifier(&arg.into(), &token, false);
812812
}
813813
ReferenceCandidate::ImportItem { base, arg } => {
814-
let Ok(base_symbol) = symbol_table::resolve(base) else {
814+
let mut base_path: GenericSymbolPath = base.into();
815+
base_path.unalias(None);
816+
let Ok(base_symbol) = symbol_table::resolve(&base_path) else {
815817
continue;
816818
};
817819

crates/analyzer/src/tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6549,6 +6549,22 @@ fn undefined_identifier() {
65496549

65506550
let errors = analyze_multiple_inputs(&inputs);
65516551
assert!(errors.is_empty());
6552+
6553+
let code = r#"
6554+
package ab_pkg::<a: u32, b: u32> {
6555+
const A: u32 = a;
6556+
const B: u32 = b;
6557+
}
6558+
alias package ab_16_32_pkg = ab_pkg::<16, 32>;
6559+
module c_module {
6560+
import ab_16_32_pkg::{A, B};
6561+
let _a: u32 = A;
6562+
let _b: u32 = B;
6563+
}
6564+
"#;
6565+
6566+
let errors = analyze(code);
6567+
assert!(errors.is_empty());
65526568
}
65536569

65546570
#[test]

0 commit comments

Comments
 (0)