Conversation
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
dae3a69 to
f7a8c45
Compare
| // In unreachable code, we infer `Never` for decorators like `typing.overload`. | ||
| // Return `true` here to avoid false positive `invalid-return-type` lints for | ||
| // `@overload`ed functions without a body in unreachable code. |
There was a problem hiding this comment.
There's maybe a better way to handle this? I can look at that again on Monday.
There was a problem hiding this comment.
Perhaps, but this seems reasonable, as long as the effect of in_function_overload_or_abstractmethod is always to silence diagnostics, not to trigger them.
|
Opening this for review. I am planning to do another (final) scan for leftover mentions of visibility/visible/etc., but feel free to highlight them if you come across one. Note that I intentionally left some uses of "visible" instead of "reachable" in comments though. I would also like to write some more tests. I've been thinking about a I also need to go over the ecosystem changes in detail, but superficially, they look good. |
crates/ty_python_semantic/src/semantic_index/reachability_constraints.rs
Outdated
Show resolved
Hide resolved
| // In unreachable code, we infer `Never` for decorators like `typing.overload`. | ||
| // Return `true` here to avoid false positive `invalid-return-type` lints for | ||
| // `@overload`ed functions without a body in unreachable code. |
There was a problem hiding this comment.
Perhaps, but this seems reasonable, as long as the effect of in_function_overload_or_abstractmethod is always to silence diagnostics, not to trigger them.
Co-authored-by: Carl Meyer <[email protected]>
## Summary Follow-up to #18621
Summary
reachability_constraints.rs.breakstatements in loopselifbranches would have wrong reachability constraintspywin32ecosystem project, which we should be able to move togood.txtonce this has been merged.Nevermore often, due to the fact that reachability constraints now apply retroactively to all active bindings, not just to bindings inside a branch.division-by-zerodiagnostic from division-by-zero error raised when conditional statements check for division by 0 ty#443 because we now inferNeverfor the divisor.closes astral-sh/ty#365
closes astral-sh/ty#624
closes astral-sh/ty#642
closes astral-sh/ty#648
Benchmarks
Benchmarks on black, pandas, and sympy showed that this is neither a performance improvement, nor a regression.
Test Plan
Regression tests for:
Footnotes
I'm afraid this is something that @carljm advocated for since the beginning, and I'm not sure anymore why we have never seriously tried this before. So I suggest we do not attempt to do a historical deep dive to find out exactly why this ever became so complicated, and just enjoy the fact that we eventually arrived here. ↩