-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Inconsistent unreachable code detection #49950
Comments
This is a known limitation. See #32695; in particular:
|
@fatcerberus, thank you for your answer! |
Also see extensive discussion about assignability from |
Wow that makes it clear from the set theory's point of view. Nevertheless it is still rather confusing for the working programmer ) |
@leetwinski Also, from a type theoretical point of view, a function that normally returns a number but might throw could be seen as returning |
Bug Report
Unreachable code detection seems to be inconsistent in case of assigning the
never
returning function call result to a var.In this case the unreachable code error isn't signaled, while it gets signaled then there's no such assignment.
🔎 Search Terms
unreachable code
🕗 Version & Regression Information
4.7.4
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
the last line of
f2
function doesn't fire an unreachable code compilation error🙂 Expected behavior
the same as that of
f1
The text was updated successfully, but these errors were encountered: