From c37d1c5b381365ce2d07dfe4b871e43995ccea2d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Nov 2019 15:49:24 +0300 Subject: Restore a mark --- crates/ra_hir_def/src/body/lower.rs | 2 ++ crates/ra_hir_def/src/body/scope.rs | 18 +++++++++++++++++- crates/ra_hir_def/src/marks.rs | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index a5bb60e85..77f091288 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -12,6 +12,7 @@ use ra_syntax::{ }, AstNode, AstPtr, }; +use test_utils::tested_by; use crate::{ body::{Body, BodySourceMap, Expander, PatPtr}, @@ -153,6 +154,7 @@ where None => self.collect_expr_opt(condition.expr()), // if let -- desugar to match Some(pat) => { + tested_by!(infer_resolve_while_let); let pat = self.collect_pat(pat); let match_expr = self.collect_expr_opt(condition.expr()); let placeholder_pat = self.missing_pat(); diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index aeb71ff22..5d7d17231 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -174,7 +174,7 @@ mod tests { use hir_expand::{name::AsName, Source}; use ra_db::{fixture::WithFixture, FileId, SourceDatabase}; use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; - use test_utils::{assert_eq_text, extract_offset}; + use test_utils::{assert_eq_text, covers, extract_offset}; use crate::{db::DefDatabase2, test_db::TestDB, FunctionId, ModuleDefId}; @@ -382,4 +382,20 @@ mod tests { 53, ); } + + #[test] + fn infer_resolve_while_let() { + covers!(infer_resolve_while_let); + do_check_local_name( + r#" +fn test() { + let foo: Option = None; + while let Option::Some(spam) = foo { + spam<|> + } +} +"#, + 75, + ); + } } diff --git a/crates/ra_hir_def/src/marks.rs b/crates/ra_hir_def/src/marks.rs index 0b99eac71..65239ca0a 100644 --- a/crates/ra_hir_def/src/marks.rs +++ b/crates/ra_hir_def/src/marks.rs @@ -11,4 +11,5 @@ test_utils::marks!( prelude_is_macro_use macro_dollar_crate_self macro_dollar_crate_other + infer_resolve_while_let ); -- cgit v1.2.3