From 795d718ba17545aedb0475051332aed6db2104ed Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 17 Feb 2019 14:43:59 +0100 Subject: Unify with the autorefed/autoderefed receiver type during method resolution --- crates/ra_hir/src/ty/tests.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crates/ra_hir/src/ty/tests.rs') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 1eca68dc5..5eb9c4f5b 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -538,6 +538,26 @@ fn test() -> i128 { ); } +#[test] +fn infer_impl_generics_with_autoderef() { + check_inference( + "infer_impl_generics_with_autoderef", + r#" +enum Option { + Some(T), + None, +} +impl Option { + fn as_ref(&self) -> Option<&T> {} +} +fn test(o: Option) { + (&o).as_ref(); + o.as_ref(); +} +"#, + ); +} + #[test] fn infer_generic_chain() { check_inference( -- cgit v1.2.3