diff options
author | Roland Ruckerbauer <[email protected]> | 2020-10-14 18:00:04 +0100 |
---|---|---|
committer | Roland Ruckerbauer <[email protected]> | 2020-10-14 18:00:04 +0100 |
commit | 0e9d1e17d6e45b44ec1a8f1430109cfc75e41241 (patch) | |
tree | a1ba22d3776968e2704d6bd269eeec2cebe4419a /crates | |
parent | 4e49b2f73144460cde5ada8140964d96166f41fd (diff) |
binary operator overload type inference: add test mark
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/simple.rs | 3 |
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 | }; |
13 | use hir_expand::name::{name, Name}; | 13 | use hir_expand::name::{name, Name}; |
14 | use syntax::ast::RangeOp; | 14 | use syntax::ast::RangeOp; |
15 | use test_utils::mark; | ||
15 | 16 | ||
16 | use crate::{ | 17 | use 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 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
2 | 3 | ||
3 | use super::{check_infer, check_types}; | 4 | use 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] |
2230 | fn infer_operator_overload() { | 2231 | fn 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]); |