fix: resolve path on all namespace on resolve_path - #22743
Conversation
This comment has been minimized.
This comment has been minimized.
9faf499 to
ad1c7c1
Compare
This comment has been minimized.
This comment has been minimized.
|
I don't think "half work" is a descriptive commit name 😅 Feel free to squash. |
|
Also for Clippy you need to rebase on master. |
I just pushed didn't think much with that 😅
I rebased a bit early lol. |
ad1c7c1 to
816b5e8
Compare
This comment has been minimized.
This comment has been minimized.
816b5e8 to
f441e34
Compare
This comment has been minimized.
This comment has been minimized.
f441e34 to
ed59858
Compare
This comment has been minimized.
This comment has been minimized.
| let mut types_is_visible = false; | ||
| let mut values_is_visible = false; | ||
| let mut macros_is_visible = false; | ||
| let mut types = types().or_else(items).map(|(res, vis)| { |
There was a problem hiding this comment.
I know I wrote this, but this can be inspect().
| .unwrap_or_else(|| PathResolutionPerNs::new(types(), None, None)) | ||
| if !resolve_per_ns { | ||
| if prefer_value_ns { | ||
| if let Some((res, vis)) = values() |
There was a problem hiding this comment.
This means we can resolve twice when !resolve_per_ns. So I think we should hoist the declaration of types, values and macros, and X_is_visible, and set them initially to None as <Option<Option<_>>> and None as Option<bool>. Then if !resolve_per_ns, return with them if they resolve to something visible, or otherwise set the corresponding namespace to Some(resolution) and X_is_visible to Some(is_visible). Then after the if, we do:
let types = types.unwrap_or_else(|| ...);
...
let types_is_visible = types_is_visible.unwrap_or_else(|| types.inspect(...));
...There was a problem hiding this comment.
I did something in this lines. I think it can now resolve at most once but correct me if I'm wrong.
ed59858 to
4bc9b21
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Thanks @ChayimFriedman2 for the initial work.