aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Ruckerbauer <[email protected]>2020-10-14 18:00:04 +0100
committerRoland Ruckerbauer <[email protected]>2020-10-14 18:00:04 +0100
commit0e9d1e17d6e45b44ec1a8f1430109cfc75e41241 (patch)
treea1ba22d3776968e2704d6bd269eeec2cebe4419a
parent4e49b2f73144460cde5ada8140964d96166f41fd (diff)
binary operator overload type inference: add test mark
-rw-r--r--crates/hir_ty/src/infer/expr.rs3
-rw-r--r--crates/hir_ty/src/tests/simple.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 8cc0d56d3..8ac4cf89a 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -12,6 +12,7 @@ use hir_def::{
12}; 12};
13use hir_expand::name::{name, Name}; 13use hir_expand::name::{name, Name};
14use syntax::ast::RangeOp; 14use syntax::ast::RangeOp;
15use test_utils::mark;
15 16
16use crate::{ 17use crate::{
17 autoderef, method_resolution, op, 18 autoderef, method_resolution, op,
@@ -537,6 +538,8 @@ impl<'a> InferenceContext<'a> {
537 let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); 538 let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone());
538 539
539 if ret == Ty::Unknown { 540 if ret == Ty::Unknown {
541 mark::hit!(infer_expr_inner_binary_operator_overload);
542
540 self.resolve_associated_type_with_params( 543 self.resolve_associated_type_with_params(
541 lhs_ty, 544 lhs_ty,
542 self.resolve_binary_op_output(op), 545 self.resolve_binary_op_output(op),
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs
index a3ae304a1..4f72582b6 100644
--- a/crates/hir_ty/src/tests/simple.rs
+++ b/crates/hir_ty/src/tests/simple.rs
@@ -1,4 +1,5 @@
1use expect_test::expect; 1use expect_test::expect;
2use test_utils::mark;
2 3
3use super::{check_infer, check_types}; 4use super::{check_infer, check_types};
4 5
@@ -2228,6 +2229,8 @@ fn generic_default_depending_on_other_type_arg_forward() {
2228 2229
2229#[test] 2230#[test]
2230fn infer_operator_overload() { 2231fn infer_operator_overload() {
2232 mark::check!(infer_expr_inner_binary_operator_overload);
2233
2231 check_infer( 2234 check_infer(
2232 r#" 2235 r#"
2233 struct V2([f32; 2]); 2236 struct V2([f32; 2]);