From 213d208e2d61576e104a9d5e003efc4ad1abc469 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 28 Apr 2020 02:10:17 +0800 Subject: Add test --- crates/ra_hir_ty/src/tests/macros.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'crates/ra_hir_ty') 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 @@ -642,6 +642,32 @@ mod clone { assert_eq!("S", type_at_pos(&db, pos)); } +#[test] +fn infer_derive_clone_in_core() { + let (db, pos) = TestDB::with_position( + r#" +//- /main.rs crate:main deps:core +use core::S; +fn test() { + S.clone()<|>; +} + +//- /lib.rs crate:core +#[prelude_import] +use clone::*; +mod clone { + trait Clone { + fn clone(&self) -> Self; + } +} +#[derive(Clone)] +pub struct S; + +"#, + ); + assert_eq!("S", type_at_pos(&db, pos)); +} + #[test] fn infer_derive_clone_with_params() { let (db, pos) = TestDB::with_position( -- cgit v1.2.3