aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-04-27 19:10:17 +0100
committerEdwin Cheng <[email protected]>2020-04-27 19:10:17 +0100
commit213d208e2d61576e104a9d5e003efc4ad1abc469 (patch)
treea9035ca97e12f301dc776c21018de1cf97ad0e80 /crates/ra_hir_ty/src
parent6a5014329aecf73da81943216729ab64fa255368 (diff)
Add test
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index 4f82ff702..ac5485bc9 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -643,6 +643,32 @@ mod clone {
643} 643}
644 644
645#[test] 645#[test]
646fn infer_derive_clone_in_core() {
647 let (db, pos) = TestDB::with_position(
648 r#"
649//- /main.rs crate:main deps:core
650use core::S;
651fn test() {
652 S.clone()<|>;
653}
654
655//- /lib.rs crate:core
656#[prelude_import]
657use clone::*;
658mod clone {
659 trait Clone {
660 fn clone(&self) -> Self;
661 }
662}
663#[derive(Clone)]
664pub struct S;
665
666"#,
667 );
668 assert_eq!("S", type_at_pos(&db, pos));
669}
670
671#[test]
646fn infer_derive_clone_with_params() { 672fn infer_derive_clone_with_params() {
647 let (db, pos) = TestDB::with_position( 673 let (db, pos) = TestDB::with_position(
648 r#" 674 r#"