implicit-any-lambda fires before generic callback contextual typing
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
The new `implicit-any-lambda` rule reports fully contextualized callback
parameters for generic functions such as `sorted`. Pyrefly's own test added
with the rule labels generic callback contextual typing as a known `bug`, but
the diagnostic now inherits strict `implicit-any` severity and reaches users.
Most of 24 new `implicit-any-lambda` corpus diagnostics follow this pattern.
## Reproduction
```python
typed_dict: dict[int, int] = {1: 2}
typed_items = sorted(typed_dict.items(), key=lambda item: (item[1], item[0]))
typed_keys = sorted(typed_dict, key=lambda key: (typed_dict[key], key))
```
With the same strict preset and interpreter:
- Pyrefly 1.1.1: clean
- Pyrefly 1.2.0-dev.3: two `implicit-any-lambda` diagnostics, plus a downstream
`unknown-argument-type`
Both lambda parameters have an unambiguous contextual type from `sorted`.
Genuinely dynamic callbacks should still report; the request is to apply
generic callback contextual typing before emitting this rule.
Related umbrella feature issue: #3661. Causal commits: 830170e3c and
c92007872.
Contributor guide
Assessment
This issue has not been assessed yet.