From 8f36f768e1ca2654da4c22983fe3c8bc3ad059a9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 29 Dec 2019 14:46:24 +0100 Subject: Don't add non-impl/trait containers to scope --- crates/ra_hir_ty/src/tests/regression.rs | 36 +++++++++++++++++++++++++++++++- crates/ra_hir_ty/src/tests/simple.rs | 3 +++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 09d684ac2..8b3aa8564 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs @@ -1,7 +1,8 @@ -use super::infer; use insta::assert_snapshot; use test_utils::covers; +use super::infer; + #[test] fn bug_484() { assert_snapshot!( @@ -331,3 +332,36 @@ pub fn main_loop() { "### ); } + +#[test] +fn issue_2669() { + assert_snapshot!( + infer( + r#"trait A {} + trait Write {} + struct Response {} + + trait D { + fn foo(); + } + + impl D for Response { + fn foo() { + end(); + fn end() { + let _x: T = loop {}; + } + } + }"# + ), + @r###" + [147; 262) '{ ... }': () + [161; 164) 'end': fn end<{unknown}>() -> () + [161; 166) 'end()': () + [199; 252) '{ ... }': () + [221; 223) '_x': ! + [230; 237) 'loop {}': ! + [235; 237) '{}': () + "### + ) +} diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index 3e5e163e3..00134c99b 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs @@ -1518,6 +1518,7 @@ fn test() { [167; 179) 'GLOBAL_CONST': u32 [189; 191) 'id': u32 [194; 210) 'Foo::A..._CONST': u32 + [126; 128) '99': u32 "### ); } @@ -1549,6 +1550,8 @@ fn test() { [233; 246) 'GLOBAL_STATIC': u32 [256; 257) 'w': u32 [260; 277) 'GLOBAL...IC_MUT': u32 + [118; 120) '99': u32 + [161; 163) '99': u32 "### ); } -- cgit v1.2.3