aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r--crates/ra_hir_ty/src/tests/regression.rs36
-rw-r--r--crates/ra_hir_ty/src/tests/simple.rs3
2 files changed, 38 insertions, 1 deletions
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 @@
1use super::infer;
2use insta::assert_snapshot; 1use insta::assert_snapshot;
3use test_utils::covers; 2use test_utils::covers;
4 3
4use super::infer;
5
5#[test] 6#[test]
6fn bug_484() { 7fn bug_484() {
7 assert_snapshot!( 8 assert_snapshot!(
@@ -331,3 +332,36 @@ pub fn main_loop() {
331 "### 332 "###
332 ); 333 );
333} 334}
335
336#[test]
337fn issue_2669() {
338 assert_snapshot!(
339 infer(
340 r#"trait A {}
341 trait Write {}
342 struct Response<T> {}
343
344 trait D {
345 fn foo();
346 }
347
348 impl<T:A> D for Response<T> {
349 fn foo() {
350 end();
351 fn end<W: Write>() {
352 let _x: T = loop {};
353 }
354 }
355 }"#
356 ),
357 @r###"
358 [147; 262) '{ ... }': ()
359 [161; 164) 'end': fn end<{unknown}>() -> ()
360 [161; 166) 'end()': ()
361 [199; 252) '{ ... }': ()
362 [221; 223) '_x': !
363 [230; 237) 'loop {}': !
364 [235; 237) '{}': ()
365 "###
366 )
367}
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() {
1518 [167; 179) 'GLOBAL_CONST': u32 1518 [167; 179) 'GLOBAL_CONST': u32
1519 [189; 191) 'id': u32 1519 [189; 191) 'id': u32
1520 [194; 210) 'Foo::A..._CONST': u32 1520 [194; 210) 'Foo::A..._CONST': u32
1521 [126; 128) '99': u32
1521 "### 1522 "###
1522 ); 1523 );
1523} 1524}
@@ -1549,6 +1550,8 @@ fn test() {
1549 [233; 246) 'GLOBAL_STATIC': u32 1550 [233; 246) 'GLOBAL_STATIC': u32
1550 [256; 257) 'w': u32 1551 [256; 257) 'w': u32
1551 [260; 277) 'GLOBAL...IC_MUT': u32 1552 [260; 277) 'GLOBAL...IC_MUT': u32
1553 [118; 120) '99': u32
1554 [161; 163) '99': u32
1552 "### 1555 "###
1553 ); 1556 );
1554} 1557}