diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 12:27:50 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 12:27:50 +0100 |
commit | dac6adbef90286f053f034eace9df65d6a19c0ff (patch) | |
tree | fe3376a1bdd3649240465fb6711f4b21cffd47f1 /crates/ra_hir/src/ty/tests.rs | |
parent | 6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (diff) | |
parent | bacf926a77a3e4040ccaf64cce1b1517e41a8d47 (diff) |
Merge #1562
1562: Continue support for .await r=matklad a=unrealhoang
- add await expr to ast and HIR Expr
- infer type for `.await`
Co-authored-by: Unreal Hoang <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 7b2bdeb3f..706500484 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -21,6 +21,41 @@ use crate::{ | |||
21 | // update the snapshots. | 21 | // update the snapshots. |
22 | 22 | ||
23 | #[test] | 23 | #[test] |
24 | fn infer_await() { | ||
25 | let (mut db, pos) = MockDatabase::with_position( | ||
26 | r#" | ||
27 | //- /main.rs | ||
28 | |||
29 | struct IntFuture; | ||
30 | |||
31 | impl Future for IntFuture { | ||
32 | type Output = u64; | ||
33 | } | ||
34 | |||
35 | fn test() { | ||
36 | let r = IntFuture; | ||
37 | let v = r.await; | ||
38 | v<|>; | ||
39 | } | ||
40 | |||
41 | //- /std.rs | ||
42 | #[prelude_import] use future::*; | ||
43 | mod future { | ||
44 | trait Future { | ||
45 | type Output; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | "#, | ||
50 | ); | ||
51 | db.set_crate_graph_from_fixture(crate_graph! { | ||
52 | "main": ("/main.rs", ["std"]), | ||
53 | "std": ("/std.rs", []), | ||
54 | }); | ||
55 | assert_eq!("u64", type_at_pos(&db, pos)); | ||
56 | } | ||
57 | |||
58 | #[test] | ||
24 | fn infer_try() { | 59 | fn infer_try() { |
25 | let (mut db, pos) = MockDatabase::with_position( | 60 | let (mut db, pos) = MockDatabase::with_position( |
26 | r#" | 61 | r#" |