Odin icon indicating copy to clipboard operation
Odin copied to clipboard

@(require_results) not enforced for procedure with polymorphic type parameter

Open z64 opened this issue 3 years ago • 1 comments

Context

    Odin: dev-2022-03:7cc185bf
    OS:   Antergos Linux, Linux 5.16.11-arch1-1
    CPU:  Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
    RAM:  7893 MiB

Expected Behavior

@(require_results) works regardless of procedure form

Current Behavior

@(require_results) is ignored in this context

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Compile the following:

package main;

T :: struct($U: int) {}

@(require_results)
foo :: proc(t: T($U)) -> bool {
    return true;
}

main :: proc() {
    x := T(0){};
    foo(x);
}

Failure Logs

(program compiles without error)

z64 avatar Mar 14 '22 03:03 z64

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]

I'm not sure when it happened, but it would seem that this is indeed fixed now. :tada:

package main;

T :: struct($U: int) {}

@(require_results)
foo :: proc(t: T($U)) -> bool {
    return true;
}

main :: proc() {
    x := T(0){};
    foo(x);
}
test.odin(12:5) 'foo' requires that its results must be handled

        foo(x)
        ^~~~~^

z64 avatar Aug 24 '22 23:08 z64