diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 29331bea5..921130b71 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -406,7 +406,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
406 | crate::ImplItem::Const(_) => None, | 406 | crate::ImplItem::Const(_) => None, |
407 | 407 | ||
408 | // TODO: Resolve associated types | 408 | // TODO: Resolve associated types |
409 | crate::ImplItem::Type(_) => None, | 409 | crate::ImplItem::TypeAlias(_) => None, |
410 | })?; | 410 | })?; |
411 | resolved = Resolution::Def(item.into()); | 411 | resolved = Resolution::Def(item.into()); |
412 | } | 412 | } |
@@ -477,7 +477,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
477 | let ty = self.insert_type_vars(ty.apply_substs(substs)); | 477 | let ty = self.insert_type_vars(ty.apply_substs(substs)); |
478 | (ty, Some(var.into())) | 478 | (ty, Some(var.into())) |
479 | } | 479 | } |
480 | TypableDef::Type(_) | TypableDef::Function(_) | TypableDef::Enum(_) => { | 480 | TypableDef::TypeAlias(_) | TypableDef::Function(_) | TypableDef::Enum(_) => { |
481 | (Ty::Unknown, None) | 481 | (Ty::Unknown, None) |
482 | } | 482 | } |
483 | } | 483 | } |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index a11d964c8..b66b8e4a5 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -10,7 +10,7 @@ use std::sync::Arc; | |||
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | Function, Struct, StructField, Enum, EnumVariant, Path, Name, | 12 | Function, Struct, StructField, Enum, EnumVariant, Path, Name, |
13 | ModuleDef, Type, | 13 | ModuleDef, TypeAlias, |
14 | HirDatabase, | 14 | HirDatabase, |
15 | type_ref::TypeRef, | 15 | type_ref::TypeRef, |
16 | name::KnownName, | 16 | name::KnownName, |
@@ -124,7 +124,7 @@ impl Ty { | |||
124 | TypableDef::Struct(s) => s.generic_params(db), | 124 | TypableDef::Struct(s) => s.generic_params(db), |
125 | TypableDef::Enum(e) => e.generic_params(db), | 125 | TypableDef::Enum(e) => e.generic_params(db), |
126 | TypableDef::EnumVariant(var) => var.parent_enum(db).generic_params(db), | 126 | TypableDef::EnumVariant(var) => var.parent_enum(db).generic_params(db), |
127 | TypableDef::Type(t) => t.generic_params(db), | 127 | TypableDef::TypeAlias(t) => t.generic_params(db), |
128 | }; | 128 | }; |
129 | let parent_param_count = def_generics.count_parent_params(); | 129 | let parent_param_count = def_generics.count_parent_params(); |
130 | substs.extend((0..parent_param_count).map(|_| Ty::Unknown)); | 130 | substs.extend((0..parent_param_count).map(|_| Ty::Unknown)); |
@@ -163,7 +163,7 @@ impl Ty { | |||
163 | TypableDef::Function(_) | 163 | TypableDef::Function(_) |
164 | | TypableDef::Struct(_) | 164 | | TypableDef::Struct(_) |
165 | | TypableDef::Enum(_) | 165 | | TypableDef::Enum(_) |
166 | | TypableDef::Type(_) => last, | 166 | | TypableDef::TypeAlias(_) => last, |
167 | TypableDef::EnumVariant(_) => { | 167 | TypableDef::EnumVariant(_) => { |
168 | // the generic args for an enum variant may be either specified | 168 | // the generic args for an enum variant may be either specified |
169 | // on the segment referring to the enum, or on the segment | 169 | // on the segment referring to the enum, or on the segment |
@@ -196,13 +196,13 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace | |||
196 | (TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s), | 196 | (TypableDef::Struct(s), Namespace::Values) => type_for_struct_constructor(db, s), |
197 | (TypableDef::Enum(e), Namespace::Types) => type_for_enum(db, e), | 197 | (TypableDef::Enum(e), Namespace::Types) => type_for_enum(db, e), |
198 | (TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v), | 198 | (TypableDef::EnumVariant(v), Namespace::Values) => type_for_enum_variant_constructor(db, v), |
199 | (TypableDef::Type(t), Namespace::Types) => type_for_type_alias(db, t), | 199 | (TypableDef::TypeAlias(t), Namespace::Types) => type_for_type_alias(db, t), |
200 | 200 | ||
201 | // 'error' cases: | 201 | // 'error' cases: |
202 | (TypableDef::Function(_), Namespace::Types) => Ty::Unknown, | 202 | (TypableDef::Function(_), Namespace::Types) => Ty::Unknown, |
203 | (TypableDef::Enum(_), Namespace::Values) => Ty::Unknown, | 203 | (TypableDef::Enum(_), Namespace::Values) => Ty::Unknown, |
204 | (TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown, | 204 | (TypableDef::EnumVariant(_), Namespace::Types) => Ty::Unknown, |
205 | (TypableDef::Type(_), Namespace::Values) => Ty::Unknown, | 205 | (TypableDef::TypeAlias(_), Namespace::Values) => Ty::Unknown, |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
@@ -302,7 +302,7 @@ fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Ty { | |||
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | fn type_for_type_alias(db: &impl HirDatabase, t: Type) -> Ty { | 305 | fn type_for_type_alias(db: &impl HirDatabase, t: TypeAlias) -> Ty { |
306 | let generics = t.generic_params(db); | 306 | let generics = t.generic_params(db); |
307 | let resolver = t.resolver(db); | 307 | let resolver = t.resolver(db); |
308 | let type_ref = t.type_ref(db); | 308 | let type_ref = t.type_ref(db); |
@@ -317,9 +317,9 @@ pub enum TypableDef { | |||
317 | Struct(Struct), | 317 | Struct(Struct), |
318 | Enum(Enum), | 318 | Enum(Enum), |
319 | EnumVariant(EnumVariant), | 319 | EnumVariant(EnumVariant), |
320 | Type(Type), | 320 | TypeAlias(TypeAlias), |
321 | } | 321 | } |
322 | impl_froms!(TypableDef: Function, Struct, Enum, EnumVariant, Type); | 322 | impl_froms!(TypableDef: Function, Struct, Enum, EnumVariant, TypeAlias); |
323 | 323 | ||
324 | impl From<ModuleDef> for Option<TypableDef> { | 324 | impl From<ModuleDef> for Option<TypableDef> { |
325 | fn from(def: ModuleDef) -> Option<TypableDef> { | 325 | fn from(def: ModuleDef) -> Option<TypableDef> { |
@@ -328,7 +328,7 @@ impl From<ModuleDef> for Option<TypableDef> { | |||
328 | ModuleDef::Struct(s) => s.into(), | 328 | ModuleDef::Struct(s) => s.into(), |
329 | ModuleDef::Enum(e) => e.into(), | 329 | ModuleDef::Enum(e) => e.into(), |
330 | ModuleDef::EnumVariant(v) => v.into(), | 330 | ModuleDef::EnumVariant(v) => v.into(), |
331 | ModuleDef::Type(t) => t.into(), | 331 | ModuleDef::TypeAlias(t) => t.into(), |
332 | ModuleDef::Const(_) | 332 | ModuleDef::Const(_) |
333 | | ModuleDef::Static(_) | 333 | | ModuleDef::Static(_) |
334 | | ModuleDef::Module(_) | 334 | | ModuleDef::Module(_) |