Skip to content

Commit 42f4659

Browse files
fix(sema): validate return ternary conditions
Signed-off-by: Aryan Baranwal <aryanbaranwal131214@gmail.com>
1 parent 6ce21bc commit 42f4659

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/sema/statements.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,8 @@ fn return_with_values(
20422042
)?;
20432043
used_variable(ns, &cond, symtable);
20442044

2045+
let cond = cond.cast(&cond.loc(), &Type::Bool, true, ns, diagnostics)?;
2046+
20452047
let left = return_with_values(left, &left.loc(), context, symtable, ns, diagnostics)?;
20462048
used_variable(ns, &left, symtable);
20472049

0 commit comments

Comments
 (0)