aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-14 12:20:42 +0100
committerGitHub <[email protected]>2020-05-14 12:20:42 +0100
commitf1587ac26332c3378c41d3cc552b270ee6a45cc4 (patch)
treea3a0d688da9315f72cad557af7598779e3937f19 /crates/ra_syntax
parent5148d6dc66d80b375a98143dfbb556ec675bbffc (diff)
parentccd526837459724211c8281926aa86522b2506d5 (diff)
Merge #4445
4445: Correctly fill default type parameters r=flodiebold a=montekki Fixes #3877 So, basically even if the parameters are omitted from the `impl` block, check the parameters in `trait` if they have a default type, and if they do go from `hir` to `ast::TypeArg`. I've added a helper for that but I am not sure that it's a proper way to go from `hir` to `ast` here. Co-authored-by: Fedor Sakharov <[email protected]>
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/make.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 12c5228f5..d0e960fb4 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -13,6 +13,10 @@ pub fn name_ref(text: &str) -> ast::NameRef {
13 ast_from_text(&format!("fn f() {{ {}; }}", text)) 13 ast_from_text(&format!("fn f() {{ {}; }}", text))
14} 14}
15 15
16pub fn type_ref(text: &str) -> ast::TypeRef {
17 ast_from_text(&format!("impl {} for D {{}};", text))
18}
19
16pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment { 20pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {
17 ast_from_text(&format!("use {};", name_ref)) 21 ast_from_text(&format!("use {};", name_ref))
18} 22}