Skip to content

Commit a9ecd9e

Browse files
committed
Improve implicit casting when applying operators
1 parent cd5f766 commit a9ecd9e

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

crates/gitql-parser/src/parser.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ fn parse_logical_and_expression(
19451945
// Check if RHS expr can be implicit casted to Expected LHS type to make this
19461946
// Expression valid
19471947
for expected_type in expected_rhs_types.iter() {
1948-
if !expected_type.has_implicit_cast_from(&lhs) {
1948+
if !expected_type.has_implicit_cast_from(&rhs) {
19491949
continue;
19501950
}
19511951

@@ -2033,7 +2033,7 @@ fn parse_bitwise_or_expression(
20332033
// Check if RHS expr can be implicit casted to Expected LHS type to make this
20342034
// Expression valid
20352035
for expected_type in expected_rhs_types.iter() {
2036-
if !expected_type.has_implicit_cast_from(&lhs) {
2036+
if !expected_type.has_implicit_cast_from(&rhs) {
20372037
continue;
20382038
}
20392039

@@ -2123,7 +2123,7 @@ fn parse_bitwise_xor_expression(
21232123
// Check if RHS expr can be implicit casted to Expected LHS type to make this
21242124
// Expression valid
21252125
for expected_type in expected_rhs_types.iter() {
2126-
if !expected_type.has_implicit_cast_from(&lhs) {
2126+
if !expected_type.has_implicit_cast_from(&rhs) {
21272127
continue;
21282128
}
21292129

@@ -2212,7 +2212,7 @@ fn parse_logical_xor_expression(
22122212
// Check if RHS expr can be implicit casted to Expected LHS type to make this
22132213
// Expression valid
22142214
for expected_type in expected_rhs_types.iter() {
2215-
if !expected_type.has_implicit_cast_from(&lhs) {
2215+
if !expected_type.has_implicit_cast_from(&rhs) {
22162216
continue;
22172217
}
22182218

@@ -2300,7 +2300,7 @@ fn parse_bitwise_and_expression(
23002300
// Check if RHS expr can be implicit casted to Expected LHS type to make this
23012301
// Expression valid
23022302
for expected_type in expected_rhs_types.iter() {
2303-
if !expected_type.has_implicit_cast_from(&lhs) {
2303+
if !expected_type.has_implicit_cast_from(&rhs) {
23042304
continue;
23052305
}
23062306

@@ -2387,7 +2387,7 @@ fn parse_equality_expression(
23872387
// Check if RHS expr can be implicit casted to Expected LHS type to make this
23882388
// Expression valid
23892389
for expected_type in expected_rhs_types.iter() {
2390-
if !expected_type.has_implicit_cast_from(&lhs) {
2390+
if !expected_type.has_implicit_cast_from(&rhs) {
23912391
continue;
23922392
}
23932393

@@ -2455,7 +2455,7 @@ fn parse_equality_expression(
24552455
// Check if RHS expr can be implicit casted to Expected LHS type to make this
24562456
// Expression valid
24572457
for expected_type in expected_rhs_types.iter() {
2458-
if !expected_type.has_implicit_cast_from(&lhs) {
2458+
if !expected_type.has_implicit_cast_from(&rhs) {
24592459
continue;
24602460
}
24612461

@@ -2608,7 +2608,7 @@ fn parse_comparison_expression(
26082608
// Check if RHS expr can be implicit casted to Expected LHS type to make this
26092609
// Expression valid
26102610
for expected_type in expected_rhs_types.iter() {
2611-
if !expected_type.has_implicit_cast_from(&lhs) {
2611+
if !expected_type.has_implicit_cast_from(&rhs) {
26122612
continue;
26132613
}
26142614

@@ -2669,7 +2669,7 @@ fn parse_comparison_expression(
26692669
// Check if RHS expr can be implicit casted to Expected LHS type to make this
26702670
// Expression valid
26712671
for expected_type in expected_rhs_types.iter() {
2672-
if !expected_type.has_implicit_cast_from(&lhs) {
2672+
if !expected_type.has_implicit_cast_from(&rhs) {
26732673
continue;
26742674
}
26752675

@@ -2730,7 +2730,7 @@ fn parse_comparison_expression(
27302730
// Check if RHS expr can be implicit casted to Expected LHS type to make this
27312731
// Expression valid
27322732
for expected_type in expected_rhs_types.iter() {
2733-
if !expected_type.has_implicit_cast_from(&lhs) {
2733+
if !expected_type.has_implicit_cast_from(&rhs) {
27342734
continue;
27352735
}
27362736

@@ -2791,7 +2791,7 @@ fn parse_comparison_expression(
27912791
// Check if RHS expr can be implicit casted to Expected LHS type to make this
27922792
// Expression valid
27932793
for expected_type in expected_rhs_types.iter() {
2794-
if !expected_type.has_implicit_cast_from(&lhs) {
2794+
if !expected_type.has_implicit_cast_from(&rhs) {
27952795
continue;
27962796
}
27972797

@@ -2871,7 +2871,7 @@ fn parse_contains_expression(
28712871

28722872
// Check if can perform the operator with additional implicit casting
28732873
for expected_type in expected_rhs_types.iter() {
2874-
if !expected_type.has_implicit_cast_from(&lhs) {
2874+
if !expected_type.has_implicit_cast_from(&rhs) {
28752875
continue;
28762876
}
28772877

@@ -3179,7 +3179,7 @@ fn parse_term_expression(
31793179
// Expression valid
31803180
let expected_lhs_types = rhs_type.can_perform_add_op_with();
31813181
for expected_type in expected_lhs_types.iter() {
3182-
if !expected_type.has_implicit_cast_from(&rhs) {
3182+
if !expected_type.has_implicit_cast_from(&lhs) {
31833183
continue;
31843184
}
31853185

@@ -3251,7 +3251,7 @@ fn parse_term_expression(
32513251
// Expression valid
32523252
let expected_lhs_types = rhs_type.can_perform_sub_op_with();
32533253
for expected_type in expected_lhs_types.iter() {
3254-
if !expected_type.has_implicit_cast_from(&rhs) {
3254+
if !expected_type.has_implicit_cast_from(&lhs) {
32553255
continue;
32563256
}
32573257

@@ -3344,7 +3344,7 @@ fn parse_factor_expression(
33443344
// Expression valid
33453345
let expected_lhs_types = rhs_type.can_perform_mul_op_with();
33463346
for expected_type in expected_lhs_types.iter() {
3347-
if !expected_type.has_implicit_cast_from(&rhs) {
3347+
if !expected_type.has_implicit_cast_from(&lhs) {
33483348
continue;
33493349
}
33503350

@@ -3414,7 +3414,7 @@ fn parse_factor_expression(
34143414
// Expression valid
34153415
let expected_lhs_types = rhs_type.can_perform_div_op_with();
34163416
for expected_type in expected_lhs_types.iter() {
3417-
if !expected_type.has_implicit_cast_from(&rhs) {
3417+
if !expected_type.has_implicit_cast_from(&lhs) {
34183418
continue;
34193419
}
34203420

@@ -3484,7 +3484,7 @@ fn parse_factor_expression(
34843484
// Expression valid
34853485
let expected_lhs_types = rhs_type.can_perform_rem_op_with();
34863486
for expected_type in expected_lhs_types.iter() {
3487-
if !expected_type.has_implicit_cast_from(&rhs) {
3487+
if !expected_type.has_implicit_cast_from(&lhs) {
34883488
continue;
34893489
}
34903490

@@ -3553,7 +3553,7 @@ fn parse_factor_expression(
35533553
// Expression valid
35543554
let expected_lhs_types = rhs_type.can_perform_caret_op_with();
35553555
for expected_type in expected_lhs_types.iter() {
3556-
if !expected_type.has_implicit_cast_from(&rhs) {
3556+
if !expected_type.has_implicit_cast_from(&lhs) {
35573557
continue;
35583558
}
35593559

0 commit comments

Comments
 (0)