Fold/visit tweaks#156130
Conversation
|
|
| const HAS_RE_ERASED = 1 << 21; | ||
|
|
||
| /// Does this have any regions of any kind? | ||
| const HAS_REGIONS = TypeFlags::HAS_FREE_REGIONS.bits() |
There was a problem hiding this comment.
Maybe add has_regions to TypeVisitableExt too and then use it instead of .has_type_flags(TypeFlags::HAS_REGIONS)?
| fn has_type_flags(&self, flags: TypeFlags) -> bool { | ||
| let res = | ||
| self.visit_with(&mut HasTypeFlagsVisitor { flags }) == ControlFlow::Break(FoundFlags); | ||
| res |
There was a problem hiding this comment.
imo comparing with ControlFlow::Break(FoundFlags) is clearer, because it asserts that Break contains FoundFlags
There was a problem hiding this comment.
Even though FoundFlags is a unit type?
There was a problem hiding this comment.
Note that has_vars_bound_at_or_above uses .is_break(). I was fixing the inconsistency and .is_break() seemed nicer.
I always choose a reviewer rather than letting bors randomly assign. Usually I choose somebody who knows the relevant part of the code well. Or if it's an easier PR that doesn't require specific expertise I just pick someone who I haven't picked for a while. |
- Remove comment about blanket implementation of `FallibleTypeFolder` -- it does not exist. (It probably used to.) - Fix some incorrect name references. - Fix minor grammatical errors. - Fix stale comment on `visit_region` -- it was a no-op once, but no longer. LLM disclosure: Claude Code identified these problems with comments when I asked it to review `fold.rs` and `visit.rs`. I verified the correctness of the problems and made the changes by hand.
- Introduce `HAS_REGIONS`/`has_regions`, which is true if any regions are present. - Add `fold_clauses` to `Shifter` and `RegionFolder` for consistency. - Simplify `has_type_flags`. - Remove unnecessary local variables in `HasTypeFlagsVisitor` methods. - Use `|=` operator in one place. LLM disclosure: Claude Code suggested these changes when I asked it to review `fold.rs` and `visit.rs`. I verified the correctness of the suggestions and made the changes by hand.
fd068fd to
dd4ce84
Compare
|
I addressed two of the three comments, and left the |
Details in individual commits.
r? @WaffleLapkin