Skip to content

Commit 76734b0

Browse files
no leak
1 parent cfe0756 commit 76734b0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pyrefly/lib/alt/class/pydantic_lax.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,15 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
170170
if class_obj.has_toplevel_qname(ModuleName::from_str("re").as_str(), "Pattern")
171171
|| class_obj.has_toplevel_qname(ModuleName::typing().as_str(), "Pattern")
172172
{
173-
let pattern_input = targs
174-
.first()
175-
.cloned()
176-
.unwrap_or_else(|| self.heap.mk_any_implicit());
173+
let pattern_input = match targs.first() {
174+
Some(Type::ClassType(cls)) if cls == self.stdlib.str() => {
175+
self.heap.mk_class_type(self.stdlib.str().clone())
176+
}
177+
Some(Type::ClassType(cls)) if cls == self.stdlib.bytes() => {
178+
self.heap.mk_class_type(self.stdlib.bytes().clone())
179+
}
180+
_ => return None,
181+
};
177182
return Some(self.union(ty.clone(), pattern_input));
178183
}
179184
None

0 commit comments

Comments
 (0)