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 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_def/src/body') 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, + ); + } } -- cgit v1.2.3 From a1346bba5c457d1aa0a35f44231bed8b494b7d60 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Nov 2019 17:09:38 +0300 Subject: Fix test mark placement --- crates/ra_hir_def/src/body/lower.rs | 2 +- crates/ra_hir_def/src/body/scope.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/body') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 77f091288..d8e911aa5 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -154,7 +154,6 @@ 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(); @@ -192,6 +191,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 5d7d17231..58740b679 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -384,7 +384,7 @@ mod tests { } #[test] - fn infer_resolve_while_let() { + fn while_let_desugaring() { covers!(infer_resolve_while_let); do_check_local_name( r#" -- cgit v1.2.3