diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/snapshots/tests__bug_651.snap | 13 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 17 |
2 files changed, 28 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/snapshots/tests__bug_651.snap b/crates/ra_hir/src/ty/snapshots/tests__bug_651.snap new file mode 100644 index 000000000..d23d3f139 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__bug_651.snap | |||
@@ -0,0 +1,13 @@ | |||
1 | --- | ||
2 | created: "2019-01-25T20:31:47.275112244+00:00" | ||
3 | creator: [email protected] | ||
4 | expression: "&result" | ||
5 | source: crates/ra_hir/src/ty/tests.rs | ||
6 | --- | ||
7 | [11; 41) '{ ...+ y; }': () | ||
8 | [21; 22) 'y': i32 | ||
9 | [25; 27) '92': i32 | ||
10 | [33; 34) '1': i32 | ||
11 | [33; 38) '1 + y': i32 | ||
12 | [37; 38) 'y': i32 | ||
13 | |||
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 92c74cf00..e0b0689f8 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | use std::fmt::Write; | 2 | use std::fmt::Write; |
3 | 3 | ||
4 | use ra_db::{SyntaxDatabase, salsa::Database}; | 4 | use ra_db::{SourceDatabase, salsa::Database}; |
5 | use ra_syntax::ast::{self, AstNode}; | 5 | use ra_syntax::ast::{self, AstNode}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
@@ -532,9 +532,22 @@ fn test() { | |||
532 | ); | 532 | ); |
533 | } | 533 | } |
534 | 534 | ||
535 | #[test] | ||
536 | fn bug_651() { | ||
537 | check_inference( | ||
538 | "bug_651", | ||
539 | r#" | ||
540 | fn quux() { | ||
541 | let y = 92; | ||
542 | 1 + y; | ||
543 | } | ||
544 | "#, | ||
545 | ); | ||
546 | } | ||
547 | |||
535 | fn infer(content: &str) -> String { | 548 | fn infer(content: &str) -> String { |
536 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 549 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
537 | let source_file = db.source_file(file_id); | 550 | let source_file = db.parse(file_id); |
538 | let mut acc = String::new(); | 551 | let mut acc = String::new(); |
539 | for fn_def in source_file | 552 | for fn_def in source_file |
540 | .syntax() | 553 | .syntax() |