-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Find legacy typevars using a TypeVisitor
#19625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.