Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Ternaries trigger @(deferred_*) procedures in the false case.

Open elusivePorpoise opened this issue 3 years ago • 1 comments

Context

Odin: dev-2022-01-nightly:fb86c23d OS: Windows 10 Home Basic (version: 20H2), build 19042.1466

Expected Behavior

Do not trigger the defer.

Current Behavior

The @(deferred_) procedure of a base procedure in the false case of a ternary is called to run at end of scope(expected in the true case). The base procedure is not called (expected).

Failure Information (for bugs)

Same behavior for the different configurations for the same expression: true ? x : proc() false ? proc() : x proc() if false else x x if true else proc()

Steps to Reproduce

@(deferred_none=Test)
TestThese :: proc()->int{
    fmt.println("in TestThese"); // does not run: EXPECTED
    return 3;
}
Test :: proc(){
    fmt.println("in Test"); // runs: NOT EXPECTED
}
main :: proc(){
    if true{
      oof := 1 if true else TestThese();
      fmt.println(oof);
    }
}
1
in Test

elusivePorpoise avatar Jan 26 '22 05:01 elusivePorpoise

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..

github-actions[bot] avatar Jul 24 '22 22:07 github-actions[bot]