We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
odin report
Odin: dev-2024-07-nightly:b4ca044 OS: Windows 10 Professional (version: 21H2), build 19044.1766 CPU: AMD Ryzen 9 5950X 16-Core Processor RAM: 130973 MiB Backend: LLVM 17.0.1
or_else should compile when a function returns a single bool or ptr value
or_else is not compiling when a function returns a single bool or ptr value
compile this with odin run .
package main import "core:fmt" proc_return_int_bool :: proc() -> (int, bool) { return 5, false } proc_return_bool :: proc() -> bool { return false } proc_return_int :: proc() -> int { return 69 } global_thing: int proc_return_rawptr :: proc() -> rawptr { return &global_thing } proc_return_int_rawptr :: proc() -> (int, rawptr) { return 32, &global_thing } main :: proc() { // compiles fine the_int := proc_return_int_bool() or_else fmt.printfln("proc_return_int_bool() or_else") // compiles fine another_int := proc_return_int_rawptr() or_else fmt.printfln("proc_return_int_rawptr() or_else") // does not compile. // Error: 'or_else' does not return a value, value is of type rawptr // proc_return_rawptr() or_else fmt.printfln("proc_return_ ... // ^~~~~~~~~~~~~~~~~~~^ // proc_return_rawptr() or_else fmt.printfln("proc_return_rawptr() or_else") // does not compile // Error: 'or_else' does not return a value, value is of type bool // proc_return_bool() or_else fmt.printfln("proc_return_bo ... // ^~~~~~~~~~~~~~~~~^ // proc_return_bool() or_else fmt.printfln("proc_return_bool() or_else") // expected to not compile // proc_return_int() or_else fmt.printfln("proc_return_int() or_else") }
The text was updated successfully, but these errors were encountered:
This is expected behaviour, or_else needs a value to return
Sorry, something went wrong.
No branches or pull requests
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
odin report
output:Odin: dev-2024-07-nightly:b4ca044
OS: Windows 10 Professional (version: 21H2), build 19044.1766
CPU: AMD Ryzen 9 5950X 16-Core Processor
RAM: 130973 MiB
Backend: LLVM 17.0.1
Expected Behavior
or_else should compile when a function returns a single bool or ptr value
Current Behavior
or_else is not compiling when a function returns a single bool or ptr value
Steps to Reproduce
compile this with odin run .
The text was updated successfully, but these errors were encountered: