Closed thacuber2a03 closed 1 year ago
@ThaCuber Certainly your code could be treated as valid. However, it would require much more advanced control flow analysis to detect all execution paths and determine if all of them end with a return
statement. Umka's approach is based on much simpler, purely syntactic considerations. At least this is safe, even if not always convenient.
I have a function with a switch statement at the end, whose default case ends with a return that should be enough to stop the "Non-void function must have a return statement" error, yet somehow it's not
(yes I am reading the Crafting Interpreters book, how'd you guess) is this intended?