aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 812d1238c..cb8d6351d 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -166,10 +166,15 @@ fn test(x: SomeType) {
166 let d: i128 = -a; 166 let d: i128 = -a;
167 let e = -100; 167 let e = -100;
168 let f = !!!true; 168 let f = !!!true;
169 let g = !42;
170 let h = !10u32;
171 let j = !a;
169 -3.14; 172 -3.14;
173 !3;
170 -x; 174 -x;
171 !x; 175 !x;
172 -"hello"; 176 -"hello";
177 !"hello";
173} 178}
174"#, 179"#,
175 ); 180 );
@@ -596,6 +601,29 @@ fn test() {
596 ); 601 );
597} 602}
598 603
604#[test]
605fn infer_type_param() {
606 check_inference(
607 "infer_type_param",
608 r#"
609fn id<T>(x: T) -> T {
610 x
611}
612
613fn clone<T>(x: &T) -> T {
614 x
615}
616
617fn test() {
618 let y = 10u32;
619 id(y);
620 let x: bool = clone(z);
621 id::<i128>(1);
622}
623"#,
624 );
625}
626
599fn infer(content: &str) -> String { 627fn infer(content: &str) -> String {
600 let (db, _, file_id) = MockDatabase::with_single_file(content); 628 let (db, _, file_id) = MockDatabase::with_single_file(content);
601 let source_file = db.parse(file_id); 629 let source_file = db.parse(file_id);