Skip to content

Commit 29aa811

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Add back a more restrictive short-circuit
Summary: This is safe as we never have two handles with different sys info that are reachable from each other. I've deliberately put this as two operations - remove the optimisation and then add back a different form, as it makes it clear the optimisation isn't load bearing. Reviewed By: yangdanny97 Differential Revision: D80084280 fbshipit-source-id: bffd40085d38f6126a1b683127a7d4942f7fe938
1 parent 1001813 commit 29aa811

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pyrefly/lib/alt/answers_solver.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -615,18 +615,14 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
615615
BindingTable: TableKeyed<K, Value = BindingEntry<K>>,
616616
SolutionsTable: TableKeyed<K, Value = SolutionsEntry<K>>,
617617
{
618-
/*
619-
// This is a tempting optimisation, but it is not sound as from a `py` file you can import your `pyi` file.
620-
if module == self.module().name() && path.is_none_or(|path| path == self.module().path())
621-
{
618+
if module == self.module().name() && path == Some(self.module().path()) {
622619
// We are working in our own module, so don't have to go back to the `LookupAnswer` trait.
623620
// But even though we are looking at our own module, we might be using our own type via an import
624621
// from a mutually recursive module, so have to deal with key_to_idx finding nothing due to incremental.
625622
Some(self.get_idx(self.bindings().key_to_idx_hashed_opt(Hashed::new(k))?))
623+
} else {
624+
self.answers.get(module, path, k, self.thread_state)
626625
}
627-
*/
628-
629-
self.answers.get(module, path, k, self.thread_state)
630626
}
631627

632628
pub fn get_from_export(

0 commit comments

Comments
 (0)