Conversation
|
Hello @evhub. Thank you for the open-source contribution opportunity Currently I am trying to figure out how to make the detection work with # validate-issue-599.coco
yield def yield_f():
return 1Result: Compiling validate-issue-599.coco ...
CoconutStyleError: found unreachable code after return statement (remove --strict to downgrade to a warning) (line 1 in 'validate-issue-599.coco')
yield def yield_f():
Coconut exiting with error: CoconutStyleErrorComplied Python file: def yield_f(): #1 (line in Coconut source)
raise _coconut.StopIteration((1)) #2 (line in Coconut source)
if False: #3 (line in Coconut source)
yield #3 (line in Coconut source)There are some ideas that I can think of:
At this point, I am unsure if my solution is heading in the right direction, and I would appreciate some guidance if possible 😅. |
Fix #599
Hello! This pull request is still in the drafting phase. There are some decisions that still need to be made before the final solution is released.
Changes
proc_funcdefduringdeferred_code_procit_ret,it_ret_none, andit_ret_tupleintarget_sys_test.cocoto avoid triggering the unreachable code checkerExamples
With
--strict:Without
--strict:Limitations
return,raise) at the top level of function bodiesBugs
yield defsyntax, as the compiler appends unreachable code at the end of the function body, causing the checker to falsely trigger