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.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index f74d6f5ea..ac12d974b 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -594,6 +594,29 @@ fn test() {
594 ); 594 );
595} 595}
596 596
597#[test]
598fn infer_type_param() {
599 check_inference(
600 "infer_type_param",
601 r#"
602fn id<T>(x: T) -> T {
603 x
604}
605
606fn clone<T>(x: &T) -> T {
607 x
608}
609
610fn test() {
611 let y = 10u32;
612 id(y);
613 let x: bool = clone(z);
614 id::<i128>(1);
615}
616"#,
617 );
618}
619
597fn infer(content: &str) -> String { 620fn infer(content: &str) -> String {
598 let (db, _, file_id) = MockDatabase::with_single_file(content); 621 let (db, _, file_id) = MockDatabase::with_single_file(content);
599 let source_file = db.parse(file_id); 622 let source_file = db.parse(file_id);