From 63e1e63a9160d28597a8d77fd83c43a2c90d3f6b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 Sep 2019 20:39:10 +0300 Subject: start cleaning up the resolution Nameres related types, like `PerNs`, can represent unreasonable situations, like a local in a type namespace. We should clean this up, by requiring that call-site specifies the kind of resolution it expects. --- crates/ra_hir/src/expr/validation.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/expr') diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 6a22e1318..c985dbdad 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -11,7 +11,7 @@ use crate::{ name, path::{PathKind, PathSegment}, ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, - Function, ModuleDef, Name, Path, PerNs, Resolution, + Function, Name, Path, }; use super::{Expr, ExprId, RecordLitField}; @@ -119,11 +119,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> { }; let resolver = self.func.resolver(db); - let std_result_enum = - match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() { - PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e, - _ => return, - }; + let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) { + Some(it) => it, + _ => return, + }; let std_result_ctor = TypeCtor::Adt(AdtDef::Enum(std_result_enum)); let params = match &mismatch.expected { -- cgit v1.2.3