diff options
author | Florian Diebold <[email protected]> | 2018-12-23 16:13:11 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-23 16:13:11 +0000 |
commit | ef67581104eb00a0c199f0b2a3b558da8a6f90a2 (patch) | |
tree | b6cf180b26152fa06ec4b2d02e22221fb7ba7fad /crates/ra_hir/src/ty/tests.rs | |
parent | 93ffbf80c632a7d38fc8bbdf6357bfd26a96a35a (diff) |
Resolve paths to defs (functions currently) during type inference
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 0880b51bc..e0458327a 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -1,5 +1,8 @@ | |||
1 | use std::fmt::Write; | 1 | use std::fmt::Write; |
2 | use std::path::{PathBuf}; | 2 | use std::path::{PathBuf}; |
3 | use std::sync::Once; | ||
4 | |||
5 | use flexi_logger::Logger; | ||
3 | 6 | ||
4 | use ra_db::{SyntaxDatabase}; | 7 | use ra_db::{SyntaxDatabase}; |
5 | use ra_syntax::ast::{self, AstNode}; | 8 | use ra_syntax::ast::{self, AstNode}; |
@@ -22,7 +25,7 @@ fn infer_file(content: &str) -> String { | |||
22 | let func = source_binder::function_from_source(&db, file_id, fn_def) | 25 | let func = source_binder::function_from_source(&db, file_id, fn_def) |
23 | .unwrap() | 26 | .unwrap() |
24 | .unwrap(); | 27 | .unwrap(); |
25 | let inference_result = func.infer(&db); | 28 | let inference_result = func.infer(&db).unwrap(); |
26 | for (syntax_ptr, ty) in &inference_result.type_for { | 29 | for (syntax_ptr, ty) in &inference_result.type_for { |
27 | let node = syntax_ptr.resolve(&source_file); | 30 | let node = syntax_ptr.resolve(&source_file); |
28 | write!( | 31 | write!( |
@@ -58,6 +61,8 @@ fn ellipsize(mut text: String, max_len: usize) -> String { | |||
58 | 61 | ||
59 | #[test] | 62 | #[test] |
60 | pub fn infer_tests() { | 63 | pub fn infer_tests() { |
64 | static INIT: Once = Once::new(); | ||
65 | INIT.call_once(|| Logger::with_env().start().unwrap()); | ||
61 | dir_tests(&test_data_dir(), &["."], |text, _path| infer_file(text)); | 66 | dir_tests(&test_data_dir(), &["."], |text, _path| infer_file(text)); |
62 | } | 67 | } |
63 | 68 | ||