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

Completion by trait bounds for fnarg #828

Closed

Conversation

kngwyu
Copy link
Collaborator

@kngwyu kngwyu commented Feb 18, 2018

By this PR, racer can complete method for generic type with trait bounds, like

fn f<T: Clone>(a: T) {
    let b = a.clo~
}

In addition, trait inheritance(like below) is also supported.

trait Tr: Clone {}
fn f<T: Tr>(a: T) {
    let b = a.clo~
}

This PR is related to #706, but what I implemented in this PR works only when FnArg has generic type T.
So, these cases are not supported now.

struct S<T> {
    mem: T
}
fn f<T: Clone>(a: S<T>) {
    let b = a.mem.clo~
}
impl<T: Clone> S<T> {
    fn f(self) {
        let b = a.mem.clo~
    } 
}

I'm going to implement these features after this PR and #825 are merged.

modified tests for trait_bounds
Remove completes_methods_for_struct_member_by_trait_bounds test.
I'm going to the feature needed to this test in next PR.
@kngwyu kngwyu mentioned this pull request Feb 18, 2018
15 tasks
@kngwyu kngwyu force-pushed the completion-by-trait-bounds-for-fnarg branch from c49490f to a39e363 Compare March 14, 2018 06:33
I forgot inserting hash of trait name after checking it's not yet inserted!
Test was also incorrect(too weak).
@kngwyu
Copy link
Collaborator Author

kngwyu commented Mar 22, 2018

This change isn't compatible with current libsyntax so I close this.

@kngwyu kngwyu closed this Mar 22, 2018
kngwyu added a commit to kngwyu/racer-nightly that referenced this pull request Apr 21, 2018
It's rebump of racer-rust#828.
As a first aid to libsyntax's change, I turned off this feature, but
now modified codes in accordance with libsyntax. Those changes are
very straight forward.
In addition, this commit includes removal of unused codes and some
refactoring of related codes.
@kngwyu kngwyu mentioned this pull request Aug 30, 2018
14 tasks
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.

1 participant