Skip to content

Commit 8244d67

Browse files
authored
Define binary symbolic compiletime ops as infix (#21683)
That way they get pretty-printed as infix in error messages.
2 parents c0974f6 + 2fce610 commit 8244d67

File tree

7 files changed

+52
-52
lines changed

7 files changed

+52
-52
lines changed

Diff for: library/src/scala/compiletime/ops/any.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object any:
1313
* ```
1414
* @syntax markdown
1515
*/
16-
type ==[X, Y] <: Boolean
16+
infix type ==[X, Y] <: Boolean
1717

1818
/** Inequality comparison of two singleton types.
1919
* ```scala
@@ -26,7 +26,7 @@ object any:
2626
* ```
2727
* @syntax markdown
2828
*/
29-
type !=[X, Y] <: Boolean
29+
infix type !=[X, Y] <: Boolean
3030

3131
/** Tests if a type is a constant.
3232
* ```scala

Diff for: library/src/scala/compiletime/ops/boolean.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object boolean:
2525
* ```
2626
* @syntax markdown
2727
*/
28-
type ^[X <: Boolean, Y <: Boolean] <: Boolean
28+
infix type ^[X <: Boolean, Y <: Boolean] <: Boolean
2929

3030
/** Conjunction of two `Boolean` singleton types.
3131
* ```scala
@@ -37,7 +37,7 @@ object boolean:
3737
* ```
3838
* @syntax markdown
3939
*/
40-
type &&[X <: Boolean, Y <: Boolean] <: Boolean
40+
infix type &&[X <: Boolean, Y <: Boolean] <: Boolean
4141

4242
/** Disjunction of two `Boolean` singleton types.
4343
* ```scala
@@ -49,4 +49,4 @@ object boolean:
4949
* ```
5050
* @syntax markdown
5151
*/
52-
type ||[X <: Boolean, Y <: Boolean] <: Boolean
52+
infix type ||[X <: Boolean, Y <: Boolean] <: Boolean

Diff for: library/src/scala/compiletime/ops/double.scala

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object double:
1111
* ```
1212
* @syntax markdown
1313
*/
14-
type +[X <: Double, Y <: Double] <: Double
14+
infix type +[X <: Double, Y <: Double] <: Double
1515

1616
/** Subtraction of two `Double` singleton types.
1717
* ```scala
@@ -22,7 +22,7 @@ object double:
2222
* ```
2323
* @syntax markdown
2424
*/
25-
type -[X <: Double, Y <: Double] <: Double
25+
infix type -[X <: Double, Y <: Double] <: Double
2626

2727
/** Multiplication of two `Double` singleton types.
2828
* ```scala
@@ -33,7 +33,7 @@ object double:
3333
* ```
3434
* @syntax markdown
3535
*/
36-
type *[X <: Double, Y <: Double] <: Double
36+
infix type *[X <: Double, Y <: Double] <: Double
3737

3838
/** Integer division of two `Double` singleton types.
3939
* ```scala
@@ -44,7 +44,7 @@ object double:
4444
* ```
4545
* @syntax markdown
4646
*/
47-
type /[X <: Double, Y <: Double] <: Double
47+
infix type /[X <: Double, Y <: Double] <: Double
4848

4949
/** Remainder of the division of `X` by `Y`.
5050
* ```scala
@@ -55,7 +55,7 @@ object double:
5555
* ```
5656
* @syntax markdown
5757
*/
58-
type %[X <: Double, Y <: Double] <: Double
58+
infix type %[X <: Double, Y <: Double] <: Double
5959

6060
/** Less-than comparison of two `Double` singleton types.
6161
* ```scala
@@ -67,7 +67,7 @@ object double:
6767
* ```
6868
* @syntax markdown
6969
*/
70-
type <[X <: Double, Y <: Double] <: Boolean
70+
infix type <[X <: Double, Y <: Double] <: Boolean
7171

7272
/** Greater-than comparison of two `Double` singleton types.
7373
* ```scala
@@ -79,7 +79,7 @@ object double:
7979
* ```
8080
* @syntax markdown
8181
*/
82-
type >[X <: Double, Y <: Double] <: Boolean
82+
infix type >[X <: Double, Y <: Double] <: Boolean
8383

8484
/** Greater-or-equal comparison of two `Double` singleton types.
8585
* ```scala
@@ -91,7 +91,7 @@ object double:
9191
* ```
9292
* @syntax markdown
9393
*/
94-
type >=[X <: Double, Y <: Double] <: Boolean
94+
infix type >=[X <: Double, Y <: Double] <: Boolean
9595

9696
/** Less-or-equal comparison of two `Double` singleton types.
9797
* ```scala
@@ -103,7 +103,7 @@ object double:
103103
* ```
104104
* @syntax markdown
105105
*/
106-
type <=[X <: Double, Y <: Double] <: Boolean
106+
infix type <=[X <: Double, Y <: Double] <: Boolean
107107

108108
/** Absolute value of an `Double` singleton type.
109109
* ```scala
@@ -114,7 +114,7 @@ object double:
114114
* ```
115115
* @syntax markdown
116116
*/
117-
type Abs[X <: Double] <: Double
117+
infix type Abs[X <: Double] <: Double
118118

119119
/** Negation of an `Double` singleton type.
120120
* ```scala
@@ -181,4 +181,4 @@ object double:
181181
* ```
182182
* @syntax markdown
183183
*/
184-
type ToFloat[X <: Double] <: Float
184+
type ToFloat[X <: Double] <: Float

Diff for: library/src/scala/compiletime/ops/float.scala

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object float:
1111
* ```
1212
* @syntax markdown
1313
*/
14-
type +[X <: Float, Y <: Float] <: Float
14+
infix type +[X <: Float, Y <: Float] <: Float
1515

1616
/** Subtraction of two `Float` singleton types.
1717
* ```scala
@@ -22,7 +22,7 @@ object float:
2222
* ```
2323
* @syntax markdown
2424
*/
25-
type -[X <: Float, Y <: Float] <: Float
25+
infix type -[X <: Float, Y <: Float] <: Float
2626

2727
/** Multiplication of two `Float` singleton types.
2828
* ```scala
@@ -33,7 +33,7 @@ object float:
3333
* ```
3434
* @syntax markdown
3535
*/
36-
type *[X <: Float, Y <: Float] <: Float
36+
infix type *[X <: Float, Y <: Float] <: Float
3737

3838
/** Integer division of two `Float` singleton types.
3939
* ```scala
@@ -44,7 +44,7 @@ object float:
4444
* ```
4545
* @syntax markdown
4646
*/
47-
type /[X <: Float, Y <: Float] <: Float
47+
infix type /[X <: Float, Y <: Float] <: Float
4848

4949
/** Remainder of the division of `X` by `Y`.
5050
* ```scala
@@ -55,7 +55,7 @@ object float:
5555
* ```
5656
* @syntax markdown
5757
*/
58-
type %[X <: Float, Y <: Float] <: Float
58+
infix type %[X <: Float, Y <: Float] <: Float
5959

6060
/** Less-than comparison of two `Float` singleton types.
6161
* ```scala
@@ -67,7 +67,7 @@ object float:
6767
* ```
6868
* @syntax markdown
6969
*/
70-
type <[X <: Float, Y <: Float] <: Boolean
70+
infix type <[X <: Float, Y <: Float] <: Boolean
7171

7272
/** Greater-than comparison of two `Float` singleton types.
7373
* ```scala
@@ -79,7 +79,7 @@ object float:
7979
* ```
8080
* @syntax markdown
8181
*/
82-
type >[X <: Float, Y <: Float] <: Boolean
82+
infix type >[X <: Float, Y <: Float] <: Boolean
8383

8484
/** Greater-or-equal comparison of two `Float` singleton types.
8585
* ```scala
@@ -91,7 +91,7 @@ object float:
9191
* ```
9292
* @syntax markdown
9393
*/
94-
type >=[X <: Float, Y <: Float] <: Boolean
94+
infix type >=[X <: Float, Y <: Float] <: Boolean
9595

9696
/** Less-or-equal comparison of two `Float` singleton types.
9797
* ```scala
@@ -103,7 +103,7 @@ object float:
103103
* ```
104104
* @syntax markdown
105105
*/
106-
type <=[X <: Float, Y <: Float] <: Boolean
106+
infix type <=[X <: Float, Y <: Float] <: Boolean
107107

108108
/** Absolute value of an `Float` singleton type.
109109
* ```scala

Diff for: library/src/scala/compiletime/ops/int.scala

+13-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object int:
2929
* ```
3030
* @syntax markdown
3131
*/
32-
type +[X <: Int, Y <: Int] <: Int
32+
infix type +[X <: Int, Y <: Int] <: Int
3333

3434
/** Subtraction of two `Int` singleton types.
3535
* ```scala
@@ -40,7 +40,7 @@ object int:
4040
* ```
4141
* @syntax markdown
4242
*/
43-
type -[X <: Int, Y <: Int] <: Int
43+
infix type -[X <: Int, Y <: Int] <: Int
4444

4545
/** Multiplication of two `Int` singleton types.
4646
* ```scala
@@ -51,7 +51,7 @@ object int:
5151
* ```
5252
* @syntax markdown
5353
*/
54-
type *[X <: Int, Y <: Int] <: Int
54+
infix type *[X <: Int, Y <: Int] <: Int
5555

5656
/** Integer division of two `Int` singleton types.
5757
* ```scala
@@ -62,7 +62,7 @@ object int:
6262
* ```
6363
* @syntax markdown
6464
*/
65-
type /[X <: Int, Y <: Int] <: Int
65+
infix type /[X <: Int, Y <: Int] <: Int
6666

6767
/** Remainder of the division of `X` by `Y`.
6868
* ```scala
@@ -73,7 +73,7 @@ object int:
7373
* ```
7474
* @syntax markdown
7575
*/
76-
type %[X <: Int, Y <: Int] <: Int
76+
infix type %[X <: Int, Y <: Int] <: Int
7777

7878
/** Binary left shift of `X` by `Y`.
7979
* ```scala
@@ -84,7 +84,7 @@ object int:
8484
* ```
8585
* @syntax markdown
8686
*/
87-
type <<[X <: Int, Y <: Int] <: Int
87+
infix type <<[X <: Int, Y <: Int] <: Int
8888

8989
/** Binary right shift of `X` by `Y`.
9090
* ```scala
@@ -95,7 +95,7 @@ object int:
9595
* ```
9696
* @syntax markdown
9797
*/
98-
type >>[X <: Int, Y <: Int] <: Int
98+
infix type >>[X <: Int, Y <: Int] <: Int
9999

100100
/** Binary right shift of `X` by `Y`, filling the left with zeros.
101101
* ```scala
@@ -106,7 +106,7 @@ object int:
106106
* ```
107107
* @syntax markdown
108108
*/
109-
type >>>[X <: Int, Y <: Int] <: Int
109+
infix type >>>[X <: Int, Y <: Int] <: Int
110110

111111
/** Bitwise xor of `X` and `Y`.
112112
* ```scala
@@ -117,7 +117,7 @@ object int:
117117
* ```
118118
* @syntax markdown
119119
*/
120-
type ^[X <: Int, Y <: Int] <: Int
120+
infix type ^[X <: Int, Y <: Int] <: Int
121121

122122
/** Less-than comparison of two `Int` singleton types.
123123
* ```scala
@@ -129,7 +129,7 @@ object int:
129129
* ```
130130
* @syntax markdown
131131
*/
132-
type <[X <: Int, Y <: Int] <: Boolean
132+
infix type <[X <: Int, Y <: Int] <: Boolean
133133

134134
/** Greater-than comparison of two `Int` singleton types.
135135
* ```scala
@@ -141,7 +141,7 @@ object int:
141141
* ```
142142
* @syntax markdown
143143
*/
144-
type >[X <: Int, Y <: Int] <: Boolean
144+
infix type >[X <: Int, Y <: Int] <: Boolean
145145

146146
/** Greater-or-equal comparison of two `Int` singleton types.
147147
* ```scala
@@ -153,7 +153,7 @@ object int:
153153
* ```
154154
* @syntax markdown
155155
*/
156-
type >=[X <: Int, Y <: Int] <: Boolean
156+
infix type >=[X <: Int, Y <: Int] <: Boolean
157157

158158
/** Less-or-equal comparison of two `Int` singleton types.
159159
* ```scala
@@ -165,7 +165,7 @@ object int:
165165
* ```
166166
* @syntax markdown
167167
*/
168-
type <=[X <: Int, Y <: Int] <: Boolean
168+
infix type <=[X <: Int, Y <: Int] <: Boolean
169169

170170
/** Bitwise and of `X` and `Y`.
171171
* ```scala

0 commit comments

Comments
 (0)