File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
emmylua_code_analysis/src/semantic/infer
emmylua_ls/src/handlers/test Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -664,10 +664,10 @@ fn infer_union_member(
664664 index_expr. clone ( ) ,
665665 & infer_guard. fork ( ) ,
666666 ) ;
667- if let Ok ( typ) = result
668- && !typ. is_nil ( )
669- {
667+ if let Ok ( typ) = result {
670668 member_types. push ( typ) ;
669+ } else {
670+ member_types. push ( LuaType :: Nil ) ;
671671 }
672672 }
673673
Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ mod tests {
2222 local _a = A:get(1):get(2):get(3)
2323 "# ,
2424 vec![
25+ VirtualCodeAction {
26+ title: "Disable current line diagnostic (need-check-nil)" . to_string( )
27+ } ,
28+ VirtualCodeAction {
29+ title: "Disable all diagnostics in current file (need-check-nil)" . to_string( )
30+ } ,
31+ VirtualCodeAction {
32+ title:
33+ "Disable all diagnostics in current project (need-check-nil)" . to_string( )
34+ } ,
2535 VirtualCodeAction {
2636 title: "use cast to remove nil" . to_string( )
2737 } ,
@@ -35,6 +45,16 @@ mod tests {
3545 title:
3646 "Disable all diagnostics in current project (need-check-nil)" . to_string( )
3747 } ,
48+ VirtualCodeAction {
49+ title: "Disable current line diagnostic (need-check-nil)" . to_string( )
50+ } ,
51+ VirtualCodeAction {
52+ title: "Disable all diagnostics in current file (need-check-nil)" . to_string( )
53+ } ,
54+ VirtualCodeAction {
55+ title:
56+ "Disable all diagnostics in current project (need-check-nil)" . to_string( )
57+ } ,
3858 VirtualCodeAction {
3959 title: "use cast to remove nil" . to_string( )
4060 } ,
You can’t perform that action at this time.
0 commit comments