Skip to content
New issue

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

Why @test signatures allowed to be mismatched? #1764

Open
alexveden opened this issue Jan 3, 2025 · 4 comments
Open

Why @test signatures allowed to be mismatched? #1764

alexveden opened this issue Jan 3, 2025 · 4 comments
Assignees
Labels
Discussion needed This feature needs discussion to iron out details

Comments

@alexveden
Copy link

alexveden commented Jan 3, 2025

The test case signature states and test runner checks the errors of running the test case:

def TestFn = fn void!();

But this test func absolutely normally runs:

//fn void(!) <- why ! is not enforced
fn void test_sub() @test {
}
@lerno
Copy link
Collaborator

lerno commented Jan 3, 2025

That is a bug.

@lerno lerno self-assigned this Jan 3, 2025
@lerno lerno added the Bug Something isn't working label Jan 3, 2025
@lerno
Copy link
Collaborator

lerno commented Jan 3, 2025

Or wait, it was a feature :( So the question is whether to allow it or not. A void test function will be turned into a void! function implicitly. So the question is whether to keep that.

@lerno lerno added Discussion needed This feature needs discussion to iron out details and removed Bug Something isn't working labels Jan 3, 2025
@alexveden
Copy link
Author

Or wait, it was a feature :( So the question is whether to allow it or not. A void test function will be turned into a void! function implicitly. So the question is whether to keep that.

You mean in user code it's possible to return errors implicitly, like this?

fn void! test_sub() @test {
    some_call_with_error()!; // <<< proparages the error and the test fails?
}

@lerno
Copy link
Collaborator

lerno commented Jan 3, 2025

Yes, but the code allows you to also use void but then the actual signature will be turned into void!

This is a little broken right now, but could be fixed. (It works but has bad side effects)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion needed This feature needs discussion to iron out details
Projects
None yet
Development

No branches or pull requests

2 participants