[ty] Find legacy typevars using a TypeVisitor#19625
Conversation
| visit_type(db, ty, |_, ty| { | ||
| if found_matching_type { | ||
| return Err(AbortTypeVisitor); | ||
| } | ||
| found_matching_type |= query(ty); | ||
| if found_matching_type { | ||
| return Err(AbortTypeVisitor); | ||
| } | ||
| Ok(()) | ||
| }); |
There was a problem hiding this comment.
Here is what it looks like to use the new recursion guard helper with a closure that automatically implements the TypeVisitor trait.
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
CodSpeed Instrumentation Performance ReportMerging #19625 will degrade performances by 35.67%Comparing Summary
Benchmarks breakdown
|
CodSpeed WallTime Performance ReportMerging #19625 will degrade performances by 4.39%Comparing Summary
Benchmarks breakdown
|
|
This should be a no-op; moving to draft while I investigate the ecosystem changes |
|
Superseded by #20124 |
|
I forgot about this PR -- it does some nice things that my PR didn't, that would be great to revisit someday. But apparently it also changed semantics, which mine didn't 😆 |
Now that we have a nice mechanism for visiting a type, we can replace the
find_legacy_typevarsmethod with aTypeVisitor. To make this happen, this PR also adds the following:AbortTypeVisitorresult to end the visitor early.TypeVisitorfor closures that have the right signature, meaning that we usually won't need to create a named type for the visitor.