diff --git a/compiler/tests/function/mod.rs b/compiler/tests/function/mod.rs index 9a2306b17e..90346098e9 100644 --- a/compiler/tests/function/mod.rs +++ b/compiler/tests/function/mod.rs @@ -78,6 +78,14 @@ fn test_multiple_returns_fail() { expect_compiler_error(program); } +#[test] +fn test_multiple_returns_fail_conditional() { + let bytes = include_bytes!("multiple_returns_fail_conditional.leo"); + let program = parse_program(bytes).unwrap(); + + expect_compiler_error(program); +} + #[test] fn test_multiple_returns_main() { let program_bytes = include_bytes!("multiple_returns_main.leo"); diff --git a/compiler/tests/function/multiple_returns_fail_conditional.leo b/compiler/tests/function/multiple_returns_fail_conditional.leo new file mode 100644 index 0000000000..04ebb9e306 --- /dev/null +++ b/compiler/tests/function/multiple_returns_fail_conditional.leo @@ -0,0 +1,9 @@ +function main () -> u16 { + if false { + let a = 1u16; + let b = a + 1u16; + return b + } else if false { + return 0u16 + } +} \ No newline at end of file