facebook / facebook/pyrefly

reduce is_subset_eq_var size

Open
#4,293 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

https://github.com/facebook/pyrefly/blob/fb7004fb993c92927a5264de237daf64ef601c55/pyrefly/lib/solver/solver.rs#L3993

has ~400LoC, (Var, Type) and (Type, Var) are mirror

how about keep Var/Var, and make other like

```rs
fn solve_var_against(
&mut self,
var: Var,
other: &Type,
side: BoundSide,
) -> Result<(), SubsetError>
```

Lower for `other <: var`, Upper for `var <: other`

Contributor guide

Open the contributing guide

Research direction

Start in pyrefly/lib/solver/solver.rs around line 3993 and inspect the existing is_subset_eq_var implementation, especially the mirrored (Var, Type) and (Type, Var) cases. Compare how BoundSide is used for lower and upper bounds, then confirm that the refactoring preserves the existing solver behavior and reduces the duplicated implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.