Odin
Odin copied to clipboard
Silent compiler error when not providing return values and using labels inside a procedure
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- Operating System & Odin Version: Odin: dev-2021-12-nightly:9d4fe903 OS: Windows 10 Professional (version: 21H2), build 19044.1348 CPU: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz RAM: 16353 MiB
Expected Behavior
Raising an error like with a regular for loop if no return value is provided
Current Behavior
When using labeled for loops inside a procedure that is supposed to return something, the compiler doesn't output an error if the said procedure doesn't return any value.
Failure Information (for bugs)
This is an example where the compiler will still compile the code even though no return value was provided:
return_ptr :: proc() -> ^int {
loop: for {
if true {
break loop
}
}
}
Whereas this will raise the expected error when trying to build:
return_ptr :: proc() -> ^int {
for {
if true {
break
}
}
}
error: Missing return statement at the end of the procedure 'return_ptr'
Hello!
I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue
- open a PR referencing and resolving the issue;
- leave a comment on it and discuss ideas how you could contribute towards resolving it;
- leave a comment and describe in detail why this issue is critical for your use case;
- open a new issue with updated details and a plan on resolving the issue.
The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..