Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Can't negate non constants in default procedure parameters

Open Skytrias opened this issue 4 years ago • 3 comments

Context

  • Operating System: Linux Mint 20 - Kernel 5.4.0-73-generic
  • Please paste odin version output: odin version dev-2021-07:f7413ca9

Expected Behavior

Negate a default procedure parameter just like constants are allowed to be negated.

Current Behavior

Works as expected on constants, but doesn't on "non constants".

Steps to Reproduce

TEST :: 0.1;
non_constant: f32 = 0.2;
a :: proc(param1: f32 = -TEST, param2: f32 = -non_constant) {
    fmt.println("hi", param1, param2);
}
main :: proc() {
    a();
}

Failure Logs

/home/michael/Schreibtisch/experimental/main.odin(17:46) Default parameter must be a constant, 2
/home/michael/Schreibtisch/experimental/main.odin(22:2) Too few arguments for 'a', expected 2 arguments, got 0

Skytrias avatar Jul 07 '21 22:07 Skytrias

This is not a bug but it does require a better error message

gingerBill avatar Jul 10 '21 10:07 gingerBill

okay :+1:

Skytrias avatar Jul 11 '21 19:07 Skytrias

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 21:07 github-actions[bot]