Another `inconsistent-overload-default` false positive
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
Minimal repro:
```python
from typing import overload
@overload
def best_match(matches: list[str]) -> str | None: ...
@overload
def best_match(matches: list[str], default: str = ...) -> str: ...
def best_match( # pyrefly: Default `None` not assignable to `str`
matches: list[str], default: str | None = None
) -> str | None:
if default is not None:
return default
return matches[0] if matches else None
```
I think it's reasonable to complain that the two overload overlaps and therefore this is ambiguous. But Pyrely is complaining about something different and less sensible: Default `None` from implementation is not assignable to overload parameter `default` with type `str`.
### Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN24AbjEpRcqTAB10AASEixE6Zhhg62eAwD6NVAwDGACwAUug4fiI6UCHAYBtO5QC6ASjoBaAHx0ndAD50AHK46DBWhJHScsKi4lJYquqaOnpGpmkWcFY2do4MLgA0dCpgqACuUAxWfgC8dJGE7t6%2BBRFRiWoadqnmxnR0AMR0ZJSqUKRWACKqFVV0AAYhYQt06Lj8qHBwEGzoqNiwjLiLTgvSAwNmRpbWtg5OzsWlc9WtlAHBoTB09csw0maPj8gX%2BiAulwgahelX4tjWGy%2BYXB6EuaLoYwY5UoqJhVQhA0x2NR1yy9gADM5OGpSfA6DAoHAfv8QIUQKNxqRCAxaFAKMMAAqkMZgCa%2BDA4Ah0fShSBsbF6CChQjSYYAZRgP0MDAYxGyAHp9RzRVzeGx9TB0PrMLh9HB9TL0HKFQwlVa6GBeHRUIJUNADkdHc7KIrQgJiK7QnAVegyAxDKEPLEdmH6pIQABmQgARgATOnpPYRNRKHBnNJyuguDw%2BDBMB5MBAxvpXcJfnQAOS7dZjDvSdYMDxjACO5SbdY8AGsYKQPKh9Pp4HB2x2AO6oHF99AgAC%2BbPnrZgADFoDAKGgsHgiGRd0A
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.