File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
crates/emmylua_code_analysis/src/compilation
analyzer/flow/var_analyze Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3- # 0.7.3(unreleased)
3+ # 0.8.0 (unreleased)
4+
5+ # 0.7.3
46
57` FIX ` Fix a crash issue
68
Original file line number Diff line number Diff line change @@ -240,6 +240,17 @@ pub fn broadcast_up_and(
240240 return Some ( ( ) ) ;
241241 }
242242 } else {
243+ // disable b broadcast_up in `a and <b> or c``
244+ if let Some ( parent_binary) = binary_expr. get_parent :: < LuaBinaryExpr > ( ) {
245+ let op = parent_binary. get_op_token ( ) ?;
246+ match op. get_op ( ) {
247+ BinaryOperator :: OpOr => {
248+ return None ;
249+ }
250+ _ => { }
251+ }
252+ }
253+
243254 let left_id = UnResolveTraceId :: Expr ( left) ;
244255 if let Some ( left_unresolve_trace_info) = var_trace. pop_unresolve_trace ( & left_id) {
245256 let left_trace_info = left_unresolve_trace_info. 1 . get_trace_info ( ) ?;
Original file line number Diff line number Diff line change 743743 "#
744744 ) )
745745 }
746+
747+ #[ test]
748+ fn test_issue_478 ( ) {
749+ let mut ws = VirtualWorkspace :: new ( ) ;
750+
751+ assert ! ( ws. check_code_for(
752+ DiagnosticCode :: ReturnTypeMismatch ,
753+ r#"
754+ --- @param line string
755+ --- @param b boolean
756+ --- @return string
757+ function foo(line, b)
758+ return b and line or line
759+ end
760+ "#
761+ ) ) ;
762+ }
746763}
You can’t perform that action at this time.
0 commit comments