Skip to content

Commit 2f08364

Browse files
committed
fix #567
1 parent a13578b commit 2f08364

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

crates/emmylua_code_analysis/src/diagnostic/checker/check_return_count.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ fn check_return_count(
282282
LuaType::Variadic(variadic) => {
283283
total_return_count += variadic.get_max_len()?;
284284
}
285+
LuaType::Nil | LuaType::Unknown => {}
285286
_ => total_return_count += 1,
286287
};
287288

crates/emmylua_code_analysis/src/diagnostic/test/check_return_count_test.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,4 +524,21 @@ mod tests {
524524
"#,
525525
));
526526
}
527+
528+
#[test]
529+
fn test_issue_567() {
530+
let mut ws = VirtualWorkspace::new_with_init_std_lib();
531+
assert!(ws.check_code_for(
532+
DiagnosticCode::RedundantReturnValue,
533+
r#"
534+
local function fnil()
535+
end
536+
537+
local f --- @type fun(c: fun())
538+
f(function()
539+
return fnil()
540+
end)
541+
"#,
542+
));
543+
}
527544
}

0 commit comments

Comments
 (0)