Skip to content

Commit 08ea136

Browse files
committed
Fix bad remove type
Fix 584
1 parent fcb6f5b commit 08ea136

File tree

1 file changed

+11
-2
lines changed
  • crates/emmylua_code_analysis/src/db_index/type/type_ops

1 file changed

+11
-2
lines changed

crates/emmylua_code_analysis/src/db_index/type/type_ops/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ impl TypeOps {
1818
pub fn apply(&self, db: &DbIndex, source: &LuaType, target: &LuaType) -> LuaType {
1919
match self {
2020
TypeOps::Union => union_type::union_type(source.clone(), target.clone()),
21-
TypeOps::Remove => remove_type::remove_type(db, source.clone(), target.clone())
22-
.unwrap_or(LuaType::Never),
21+
TypeOps::Remove => {
22+
let result = remove_type::remove_type(db, source.clone(), target.clone());
23+
if let Some(result) = result {
24+
return result;
25+
}
26+
27+
match &source {
28+
LuaType::Nil => LuaType::Never,
29+
_ => source.clone(),
30+
}
31+
}
2332
}
2433
}
2534
}

0 commit comments

Comments
 (0)