File tree Expand file tree Collapse file tree 3 files changed +12
-18
lines changed
crates/emmylua_code_analysis/src Expand file tree Collapse file tree 3 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ impl LuaType {
195
195
pub fn is_table ( & self ) -> bool {
196
196
matches ! (
197
197
self ,
198
- LuaType :: Table | LuaType :: TableGeneric ( _) | LuaType :: TableConst ( _) | LuaType :: Global
198
+ LuaType :: Table | LuaType :: TableGeneric ( _) | LuaType :: TableConst ( _) | LuaType :: Global | LuaType :: Tuple ( _ )
199
199
)
200
200
}
201
201
Original file line number Diff line number Diff line change @@ -66,9 +66,16 @@ fn infer_doc_func_type_compact_for_params(
66
66
compact_params. insert ( 0 , ( "self" . to_string ( ) , None ) ) ;
67
67
}
68
68
69
- let source_len = source_params. len ( ) ;
70
- for i in 0 ..source_len {
71
- let source_param = & source_params[ i] ;
69
+ let compact_len = compact_params. len ( ) ;
70
+ for i in 0 ..compact_len {
71
+ let source_param = match source_params. get ( i) {
72
+ Some ( p) => p,
73
+ None => {
74
+ return false ;
75
+ }
76
+ } ;
77
+ let compact_param = & compact_params[ i] ;
78
+
72
79
let source_param_type = & source_param. 1 ;
73
80
// too many complex session to handle varargs
74
81
if source_param. 0 == "..." {
@@ -85,19 +92,6 @@ fn infer_doc_func_type_compact_for_params(
85
92
return false ;
86
93
}
87
94
88
- let compact_param = match compact_params. get ( i) {
89
- Some ( p) => p,
90
- None => {
91
- if let Some ( source_type) = & source_param. 1 {
92
- if source_type. is_optional ( ) {
93
- continue ;
94
- }
95
- } ;
96
-
97
- return false ;
98
- }
99
- } ;
100
-
101
95
if compact_param. 0 == "..." {
102
96
break ;
103
97
}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ fn infer_type_compact(
78
78
LuaType :: DocStringConst ( t) => * s == t,
79
79
_ => false ,
80
80
} ,
81
- ( LuaType :: FloatConst ( _) , _ ) => compact_type . is_number ( ) ,
81
+ ( LuaType :: FloatConst ( _) , right ) if right . is_number ( ) => true ,
82
82
( LuaType :: Table , _) => {
83
83
compact_type. is_table ( )
84
84
|| compact_type. is_array ( )
You can’t perform that action at this time.
0 commit comments