Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/tests/coercion.rs')
| -rw-r--r-- | crates/hir_ty/src/tests/coercion.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs index bcec109204..dd3b86f050 100644 --- a/crates/hir_ty/src/tests/coercion.rs +++ b/crates/hir_ty/src/tests/coercion.rs @@ -630,3 +630,27 @@ fn test() { "#, ) } + +#[test] +fn coerce_overloaded_binary_op_rhs() { + check_types( + r#" +//- minicore: deref, add + +struct String {} +impl core::ops::Deref for String { type Target = str; } + +impl core::ops::Add<&str> for String { + type Output = String; +} + +fn test() { + let s1 = String {}; + let s2 = String {}; + s1 + &s2; + //^^^^^^^^ String +} + + "#, + ); +} |