Skip to content

Commit fa84ea7

Browse files
committed
refactor: rename operator traits for consistency
1 parent abf69bc commit fa84ea7

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

builtin/builtin.mbti

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,22 @@ impl Logger {
655655
// Type aliases
656656

657657
// Traits
658+
pub(open) trait Add {
659+
op_add(Self, Self) -> Self
660+
}
661+
662+
pub(open) trait BitAnd {
663+
land(Self, Self) -> Self
664+
}
665+
666+
pub(open) trait BitOr {
667+
lor(Self, Self) -> Self
668+
}
669+
670+
pub(open) trait BitXOr {
671+
lxor(Self, Self) -> Self
672+
}
673+
658674
pub(open) trait Compare : Eq {
659675
compare(Self, Self) -> Int
660676
}
@@ -697,6 +713,10 @@ impl Default for UInt64
697713
impl Default for Double
698714
impl[X] Default for FixedArray[X]
699715

716+
pub(open) trait Div {
717+
op_div(Self, Self) -> Self
718+
}
719+
700720
pub(open) trait Eq {
701721
op_equal(Self, Self) -> Bool
702722
}
@@ -757,50 +777,22 @@ pub(open) trait Logger {
757777
}
758778
impl Logger::write_sub_string
759779

760-
pub(open) trait OperatorAdd {
761-
op_add(Self, Self) -> Self
762-
}
763-
764-
pub(open) trait OperatorBitAnd {
765-
land(Self, Self) -> Self
766-
}
767-
768-
pub(open) trait OperatorBitOr {
769-
lor(Self, Self) -> Self
770-
}
771-
772-
pub(open) trait OperatorBitXOr {
773-
lxor(Self, Self) -> Self
774-
}
775-
776-
pub(open) trait OperatorDiv {
777-
op_div(Self, Self) -> Self
778-
}
779-
780-
pub(open) trait OperatorMod {
780+
pub(open) trait Mod {
781781
op_mod(Self, Self) -> Self
782782
}
783783

784-
pub(open) trait OperatorMul {
784+
pub(open) trait Mul {
785785
op_mul(Self, Self) -> Self
786786
}
787787

788-
pub(open) trait OperatorNeg {
788+
pub(open) trait Neg {
789789
op_neg(Self) -> Self
790790
}
791791

792-
pub(open) trait OperatorShl {
792+
pub(open) trait Shl {
793793
op_shl(Self, Int) -> Self
794794
}
795795

796-
pub(open) trait OperatorShr {
797-
op_shr(Self, Int) -> Self
798-
}
799-
800-
pub(open) trait OperatorSub {
801-
op_sub(Self, Self) -> Self
802-
}
803-
804796
pub(open) trait Show {
805797
output(Self, &Logger) -> Unit
806798
to_string(Self) -> String
@@ -838,6 +830,14 @@ impl[T0 : Show, T1 : Show, T2 : Show, T3 : Show, T4 : Show, T5 : Show, T6 : Show
838830
impl[T0 : Show, T1 : Show, T2 : Show, T3 : Show, T4 : Show, T5 : Show, T6 : Show, T7 : Show, T8 : Show, T9 : Show, T10 : Show, T11 : Show, T12 : Show, T13 : Show, T14 : Show] Show for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
839831
impl[T0 : Show, T1 : Show, T2 : Show, T3 : Show, T4 : Show, T5 : Show, T6 : Show, T7 : Show, T8 : Show, T9 : Show, T10 : Show, T11 : Show, T12 : Show, T13 : Show, T14 : Show, T15 : Show] Show for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
840832

833+
pub(open) trait Shr {
834+
op_shr(Self, Int) -> Self
835+
}
836+
837+
pub(open) trait Sub {
838+
op_sub(Self, Self) -> Self
839+
}
840+
841841
pub(open) trait ToJson {
842842
to_json(Self) -> Json
843843
}

builtin/operators.mbt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,66 @@
1414

1515
///|
1616
/// types implementing this trait can use the `+` operator
17-
pub(open) trait OperatorAdd {
17+
pub(open) trait Add {
1818
op_add(Self, Self) -> Self
1919
}
2020

2121
///|
2222
/// types implementing this trait can use the `-` operator
23-
pub(open) trait OperatorSub {
23+
pub(open) trait Sub {
2424
op_sub(Self, Self) -> Self
2525
}
2626

2727
///|
2828
/// types implementing this trait can use the `*` operator
29-
pub(open) trait OperatorMul {
29+
pub(open) trait Mul {
3030
op_mul(Self, Self) -> Self
3131
}
3232

3333
///|
3434
/// types implementing this trait can use the `/` operator
35-
pub(open) trait OperatorDiv {
35+
pub(open) trait Div {
3636
op_div(Self, Self) -> Self
3737
}
3838

3939
///|
4040
/// types implementing this trait can use the unary `-` operator
41-
pub(open) trait OperatorNeg {
41+
pub(open) trait Neg {
4242
op_neg(Self) -> Self
4343
}
4444

4545
///|
4646
/// types implementing this trait can use the `%` operator
47-
pub(open) trait OperatorMod {
47+
pub(open) trait Mod {
4848
op_mod(Self, Self) -> Self
4949
}
5050

5151
///|
5252
/// types implementing this trait can use the `&` operator
53-
pub(open) trait OperatorBitAnd {
53+
pub(open) trait BitAnd {
5454
land(Self, Self) -> Self
5555
}
5656

5757
///|
5858
/// types implementing this trait can use the `|` operator
59-
pub(open) trait OperatorBitOr {
59+
pub(open) trait BitOr {
6060
lor(Self, Self) -> Self
6161
}
6262

6363
///|
6464
/// types implementing this trait can use the `^` operator
65-
pub(open) trait OperatorBitXOr {
65+
pub(open) trait BitXOr {
6666
lxor(Self, Self) -> Self
6767
}
6868

6969
///|
7070
/// types implementing this trait can use the `<<` operator
71-
pub(open) trait OperatorShl {
71+
pub(open) trait Shl {
7272
op_shl(Self, Int) -> Self
7373
}
7474

7575
///|
7676
/// types implementing this trait can use the `>>` operator
77-
pub(open) trait OperatorShr {
77+
pub(open) trait Shr {
7878
op_shr(Self, Int) -> Self
7979
}

0 commit comments

Comments
 (0)