Skip to content

Commit eadd15f

Browse files
rchen152meta-codesync[bot]
authored andcommitted
Fix overeager replacement of Type::Any with Type::Materialization
Summary: `Type::materialize()` was replacing `Any` with `Materialization` everywhere, including unexpected places like the tparams in enum classes stored in literals. Differential Revision: D95641165
1 parent 6f65f27 commit eadd15f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/pyrefly_types/src/types.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,16 +1749,18 @@ impl Type {
17491749
}
17501750

17511751
pub fn materialize(&self) -> Self {
1752-
self.clone().transform(&mut |ty| {
1752+
let mut ty = self.clone();
1753+
ty.transform_types_in_type_variable_positions(&mut |ty| {
17531754
if ty.is_any() {
17541755
*ty = Type::Materialization;
17551756
}
17561757
ty.transform_toplevel_callable(&mut |callable: &mut Callable| {
17571758
if matches!(callable.params, Params::Ellipsis) {
17581759
callable.params = Params::Materialization;
17591760
}
1760-
})
1761-
})
1761+
});
1762+
});
1763+
ty
17621764
}
17631765

17641766
/// Creates a union from the provided types without simplifying

0 commit comments

Comments
 (0)