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

Missing return ignored after short-circuited throw #10865

Closed
Aurel300 opened this issue Nov 30, 2022 · 1 comment
Closed

Missing return ignored after short-circuited throw #10865

Aurel300 opened this issue Nov 30, 2022 · 1 comment
Assignees

Comments

@Aurel300
Copy link
Member

class Main {
  public static function main():Void trace(foo());
  public static function foo():Int {
    true || throw 0;
    0;
  }
}

foo should return an integer but it does not: the trace outputs null (on Eval). If I remove the true || throw 0 line, the error "Missing return: Int" is triggered as expected. I can also use false && throw 0. I wonder if this is related to #10791 (or a similar analysis).

@Simn
Copy link
Member

Simn commented Dec 1, 2022

Nice find!

@Simn Simn self-assigned this Dec 1, 2022
@Simn Simn closed this as completed in b89ab01 Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants