diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 20:08:10 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 20:08:10 +0000 |
commit | 61d961263387f7293f3d0c4d7b8c8c9a07959ced (patch) | |
tree | b22232818d8d8ad8fff5b11b1656e2602115cd55 /crates/ra_hir/src/ty/snapshots | |
parent | 5a684099e9aa3482b408002030fafe1dcd0fa9a9 (diff) | |
parent | c3c09795614f31f988edc9cb051ce024d1996d89 (diff) |
Merge #892
892: Type aliases r=matklad a=flodiebold
This implements type aliases (i.e. `type` definitions).
There's just one snag: handling recursion. E.g. `type Foo = Foo` makes type inference panic with a query cycle. I think the best way to handle this would be if Salsa provided the ability to catch cycle errors? It seems that there's some work underway to support this [here](https://github.com/salsa-rs/salsa/issues/6) and [here](https://github.com/salsa-rs/salsa/pull/147). Should we wait for this? I don't see a good way to handle this without help from Salsa.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/snapshots')
-rw-r--r-- | crates/ra_hir/src/ty/snapshots/tests__infer_type_alias.snap | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_type_alias.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_type_alias.snap new file mode 100644 index 000000000..241c08353 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_type_alias.snap | |||
@@ -0,0 +1,23 @@ | |||
1 | --- | ||
2 | created: "2019-02-24T16:13:47.561870283Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_hir/src/ty/tests.rs | ||
5 | expression: "&result" | ||
6 | --- | ||
7 | [117; 118) 'x': A<u32, i128> | ||
8 | [125; 126) 'y': A<&str, u128> | ||
9 | [139; 140) 'z': A<u8, i8> | ||
10 | [155; 212) '{ ...z.y; }': () | ||
11 | [161; 162) 'x': A<u32, i128> | ||
12 | [161; 164) 'x.x': u32 | ||
13 | [170; 171) 'x': A<u32, i128> | ||
14 | [170; 173) 'x.y': i128 | ||
15 | [179; 180) 'y': A<&str, u128> | ||
16 | [179; 182) 'y.x': &str | ||
17 | [188; 189) 'y': A<&str, u128> | ||
18 | [188; 191) 'y.y': u128 | ||
19 | [197; 198) 'z': A<u8, i8> | ||
20 | [197; 200) 'z.x': u8 | ||
21 | [206; 207) 'z': A<u8, i8> | ||
22 | [206; 209) 'z.y': i8 | ||
23 | |||