mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-10 05:39:12 +00:00
![]() This is a follow-on to #18155. For the example raised in https://github.com/astral-sh/ty/issues/370: ```py import tempfile with tempfile.TemporaryDirectory() as tmp: ... ``` the new logic would notice that both overloads of `TemporaryDirectory` match, and combine their specializations, resulting in an inferred type of `str | bytes`. This PR updates the logic to match our other handling of other calls, where we only keep the _first_ matching overload. The result for this example then becomes `str`, matching the runtime behavior. (We still do not implement the full [overload resolution algorithm](https://typing.python.org/en/latest/spec/overload.html#overload-call-evaluation) from the spec.) |
||
---|---|---|
.. | ||
resources | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml | ||
mdtest.py | ||
mdtest.py.lock |