facebook / facebook/pyrefly

Float assigned to int-inferred attribute

Open
#3,055 0 comments 1 reaction 0 assignees View on GitHub
needs-discussion typechecking usability
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Minimal repro:
```python
import time

class Monitor:
def __init__(self) -> None:
self.last_checked = 0

def check(self) -> None:
self.last_checked = time.time() # FP: float not assignable to int
```
Mypy aligns with Pyrefly. But Ty and Pyright don't treat this as an error. What should we do?

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIEAtsbgE4AuABA9TADrqcDGUqccJgFlc6CA3qJOTGU0wwwTAPpKIYhioAUcGFDABKJgFoAfEwByomFPSy7THXsJ84G7gAsY3ANYxMTAF4mAAZOaVl5RQ8vb21dA2MzS3RrcPsHeOd%2BN08fP0CWNkJWKhhNQyYAYiYAMQAFRCYwKFxUZnRcZn44CABzdFRsWBZcJjUGEAAaEABXVig4EnJEEGqAVXnxUiaZ9G5WUTgwrAUm%2Bio2pXQZqmwYOk18RvHDUwcGOhs7OhgGGbpbGB2CBzDc7p8mMB8ABfYGcKYgMg-ZqkYq4KhQCjVOqkZFQbZoLB4fBMbiiSC9f5tCCiQicaoAZRgMCY7gYDGIcEQAHpuUiFPjCPRetyYOhuZhcNw4NyyegKVSDuKznQmKgAG6oaCDYZyhV0amiJi4YhKxacMgMdyiIzq%2B49I1BYEAZkIAEYAExw9AgaHTVD7CB2mrQGAUQk4AhLX1AA

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.