facebook / facebook/pyrefly

Simplify unions based on subclass relationships

Open
#2,638 3 comments 0 reactions 0 assignees View on GitHub
google needs-discussion typechecking
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

`int | bool` should simplify to `int` since `bool` is a subclass of `int`

We don't simplify unions based on subclass relationships right now because the representation of types makes it fairly expensive. The downside of not doing this is that we make unions that are larger than necessary, which degrades performance.

Will need to profile this if we do it

### Sandbox Link

_No response_

### (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.