Skip to content
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

Fix regressed test due to rust-lang/rust#78461 #1144

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

Xanewok
Copy link
Collaborator

@Xanewok Xanewok commented Dec 1, 2020

See #1143 for more context.

One concrete example is when we have a partially resolved generic type
which calls a `Self`-returning method, e.g. `Vec<String, _>::new()`.

Previously, the returned type for `Self`-returning methods would return
the unresolved, generic type as encountered in the impl header (so
`Vec<T, A: AllocRef = Global>` in this case). However, if the method
match already carries some information about generics (T := String
here), make sure to account for it.
@Xanewok Xanewok requested a review from kngwyu December 1, 2020 00:25
src/racer/ast.rs Outdated
if let (Some(Ty::Match(ref mut m)), Some(gen)) = (&mut return_ty, gen) {
let resolved = gen.args().filter_map(|tp| tp.resolved());
for (l, r) in m.generics_mut().zip(resolved) {
l.resolve(r.clone());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a hack but I encountered a similar resolve/substitution code in other places, so it seems it's not as out of place as it looks at a first glance.

There may be other designs how to tackle this but decided for it because it's least invasive for now.

Copy link
Collaborator

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

src/racer/ast.rs Outdated Show resolved Hide resolved
Otherwise we may have an order mismatch

Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
@Xanewok
Copy link
Collaborator Author

Xanewok commented Dec 2, 2020

Squashed the last few fixup commits and force-pushed

@Xanewok Xanewok mentioned this pull request Dec 2, 2020
@Xanewok
Copy link
Collaborator Author

Xanewok commented Dec 2, 2020

Going to merge the final version since it's approved. Thanks for taking a look!

@Xanewok Xanewok merged commit 9888114 into racer-rust:master Dec 2, 2020
@Xanewok Xanewok deleted the fix-regressed-vec branch December 2, 2020 16:43
@kngwyu
Copy link
Collaborator

kngwyu commented Dec 4, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants