facebook / facebook/pyrefly

support `Truthy`/`Falsy` types

Open
#1,142 5 comments 0 reactions 0 assignees View on GitHub
typechecking
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

```py
class A: ...

def f(a: A):
assert a
reveal_type(a) # A, expected A & Not[Falsey]
```

### Sandbox Link

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating Pyrefly's handling of assert-based type narrowing and the tests covering truthiness or falsiness. Trace how the asserted value is represented, then add coverage for the example where `reveal_type(a)` should become `A & Not[Falsey]`; done means the narrowing is reported as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
compilers, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.