Skip to content

Commit 24637d9

Browse files
committed
fix #1136
1 parent 7184825 commit 24637d9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

crates/emmylua_code_analysis/src/compilation/analyzer/doc/type_def_tags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn analyze_alias(analyzer: &mut DocAnalyzer, tag: LuaDocTagAlias) -> Option<
144144

145145
if tag.get_generic_decl_list().is_some() {
146146
let generic_params = get_type_generic_params(analyzer, &alias_decl_id);
147-
let range = analyzer.comment.get_range();
147+
let range = tag.get_range();
148148
let scope_id = analyzer
149149
.type_context
150150
.generic_index

crates/emmylua_code_analysis/src/diagnostic/test/undefined_field_test.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ mod test {
100100
));
101101
}
102102

103+
#[test]
104+
fn test_adjacent_alias_generic_scope_for_mapped_type() {
105+
let mut ws = VirtualWorkspace::new();
106+
assert!(ws.has_no_diagnostic(
107+
DiagnosticCode::InjectField,
108+
r#"
109+
---@alias AA<T> true
110+
---@alias FakePartial<T> {[P in keyof T]?: T[P]; }
111+
112+
---@type FakePartial<{[1]:boolean}>
113+
local tmp
114+
tmp[1] = nil
115+
"#
116+
));
117+
}
118+
103119
#[test]
104120
fn test_any_key() {
105121
let mut ws = VirtualWorkspace::new_with_init_std_lib();

0 commit comments

Comments
 (0)