diff options
author | Lukas Wirth <[email protected]> | 2021-02-28 18:46:59 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-02-28 19:15:56 +0000 |
commit | faf2dd49e4845e1437b704a28bb5603be5fd605b (patch) | |
tree | f3183d296fada9a5847687f5bbdf0c336ed65504 /crates/hir | |
parent | a3f5491a1a312393429a44028e7496fe0a12f8c2 (diff) |
Fix code_model::Type::walk not walking all types
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/code_model.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 8e77a4a41..cdb54eca2 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -1924,21 +1924,18 @@ impl Type { | |||
1924 | fn walk_type(db: &dyn HirDatabase, type_: &Type, cb: &mut impl FnMut(Type)) { | 1924 | fn walk_type(db: &dyn HirDatabase, type_: &Type, cb: &mut impl FnMut(Type)) { |
1925 | let ty = type_.ty.value.strip_references(); | 1925 | let ty = type_.ty.value.strip_references(); |
1926 | match ty { | 1926 | match ty { |
1927 | Ty::Adt(_, parameters) => { | 1927 | Ty::Adt(..) => { |
1928 | cb(type_.derived(ty.clone())); | 1928 | cb(type_.derived(ty.clone())); |
1929 | walk_substs(db, type_, parameters, cb); | ||
1930 | } | 1929 | } |
1931 | Ty::AssociatedType(_, parameters) => { | 1930 | Ty::AssociatedType(..) => { |
1932 | if let Some(_) = ty.associated_type_parent_trait(db) { | 1931 | if let Some(_) = ty.associated_type_parent_trait(db) { |
1933 | cb(type_.derived(ty.clone())); | 1932 | cb(type_.derived(ty.clone())); |
1934 | } | 1933 | } |
1935 | walk_substs(db, type_, parameters, cb); | ||
1936 | } | 1934 | } |
1937 | Ty::OpaqueType(_, parameters) => { | 1935 | Ty::OpaqueType(..) => { |
1938 | if let Some(bounds) = ty.impl_trait_bounds(db) { | 1936 | if let Some(bounds) = ty.impl_trait_bounds(db) { |
1939 | walk_bounds(db, &type_.derived(ty.clone()), &bounds, cb); | 1937 | walk_bounds(db, &type_.derived(ty.clone()), &bounds, cb); |
1940 | } | 1938 | } |
1941 | walk_substs(db, type_, parameters, cb); | ||
1942 | } | 1939 | } |
1943 | Ty::Opaque(opaque_ty) => { | 1940 | Ty::Opaque(opaque_ty) => { |
1944 | if let Some(bounds) = ty.impl_trait_bounds(db) { | 1941 | if let Some(bounds) = ty.impl_trait_bounds(db) { |
@@ -1956,7 +1953,10 @@ impl Type { | |||
1956 | walk_bounds(db, &type_.derived(ty.clone()), bounds.as_ref(), cb); | 1953 | walk_bounds(db, &type_.derived(ty.clone()), bounds.as_ref(), cb); |
1957 | } | 1954 | } |
1958 | 1955 | ||
1959 | _ => (), | 1956 | _ => {} |
1957 | } | ||
1958 | if let Some(substs) = ty.substs() { | ||
1959 | walk_substs(db, type_, &substs, cb); | ||
1960 | } | 1960 | } |
1961 | } | 1961 | } |
1962 | 1962 | ||