Skip to content

Commit 8a629f2

Browse files
committed
Fix #593
1 parent 75687b2 commit 8a629f2

File tree

1 file changed

+15
-1
lines changed
  • crates/emmylua_code_analysis/src/db_index/type

1 file changed

+15
-1
lines changed

crates/emmylua_code_analysis/src/db_index/type/types.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,21 @@ impl LuaTupleType {
443443
}
444444

445445
pub fn get_type(&self, idx: usize) -> Option<&LuaType> {
446-
self.types.get(idx)
446+
if let Some(ty) = self.types.get(idx) {
447+
return Some(ty);
448+
};
449+
450+
if self.types.is_empty() {
451+
return None;
452+
}
453+
454+
let last_id = self.types.len() - 1;
455+
let last_type = self.types.get(last_id)?;
456+
if let LuaType::Variadic(variadic) = last_type {
457+
return variadic.get_type(idx - last_id);
458+
}
459+
460+
None
447461
}
448462

449463
pub fn len(&self) -> usize {

0 commit comments

Comments
 (0)