Fixes #1103
Pull-Request: #1114
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
var nblock = self.n_block
if nblock != null then
v.visit_stmt(nblock)
+ if not nblock.after_flow_context.is_unreachable then
+ # We reach the end of the init without having a return, it is bad
+ v.error(self, "Control error: Reached end of block (a 'return' with a value was expected).")
+ end
end
end
end
2.output
var res = a
if res == 10 then res = 20
- return res
+ return res #alt1# return #alt2#
end
end
--- /dev/null
+alt/base_attr_init_val_block_alt1.nit:27,3--8: Error: Return without value in a function.
--- /dev/null
+alt/base_attr_init_val_block_alt2.nit:23,6: Control error: Reached end of block (a 'return' with a value was expected).