Skip to content

Commit

Permalink
Define binary symbolic compiletime ops as infix (#21683)
Browse files Browse the repository at this point in the history
That way they get pretty-printed as infix in error messages.
  • Loading branch information
smarter authored Oct 1, 2024
2 parents c0974f6 + 2fce610 commit 8244d67
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions library/src/scala/compiletime/ops/any.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object any:
* ```
* @syntax markdown
*/
type ==[X, Y] <: Boolean
infix type ==[X, Y] <: Boolean

/** Inequality comparison of two singleton types.
* ```scala
Expand All @@ -26,7 +26,7 @@ object any:
* ```
* @syntax markdown
*/
type !=[X, Y] <: Boolean
infix type !=[X, Y] <: Boolean

/** Tests if a type is a constant.
* ```scala
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/compiletime/ops/boolean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object boolean:
* ```
* @syntax markdown
*/
type ^[X <: Boolean, Y <: Boolean] <: Boolean
infix type ^[X <: Boolean, Y <: Boolean] <: Boolean

/** Conjunction of two `Boolean` singleton types.
* ```scala
Expand All @@ -37,7 +37,7 @@ object boolean:
* ```
* @syntax markdown
*/
type &&[X <: Boolean, Y <: Boolean] <: Boolean
infix type &&[X <: Boolean, Y <: Boolean] <: Boolean

/** Disjunction of two `Boolean` singleton types.
* ```scala
Expand All @@ -49,4 +49,4 @@ object boolean:
* ```
* @syntax markdown
*/
type ||[X <: Boolean, Y <: Boolean] <: Boolean
infix type ||[X <: Boolean, Y <: Boolean] <: Boolean
22 changes: 11 additions & 11 deletions library/src/scala/compiletime/ops/double.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object double:
* ```
* @syntax markdown
*/
type +[X <: Double, Y <: Double] <: Double
infix type +[X <: Double, Y <: Double] <: Double

/** Subtraction of two `Double` singleton types.
* ```scala
Expand All @@ -22,7 +22,7 @@ object double:
* ```
* @syntax markdown
*/
type -[X <: Double, Y <: Double] <: Double
infix type -[X <: Double, Y <: Double] <: Double

/** Multiplication of two `Double` singleton types.
* ```scala
Expand All @@ -33,7 +33,7 @@ object double:
* ```
* @syntax markdown
*/
type *[X <: Double, Y <: Double] <: Double
infix type *[X <: Double, Y <: Double] <: Double

/** Integer division of two `Double` singleton types.
* ```scala
Expand All @@ -44,7 +44,7 @@ object double:
* ```
* @syntax markdown
*/
type /[X <: Double, Y <: Double] <: Double
infix type /[X <: Double, Y <: Double] <: Double

/** Remainder of the division of `X` by `Y`.
* ```scala
Expand All @@ -55,7 +55,7 @@ object double:
* ```
* @syntax markdown
*/
type %[X <: Double, Y <: Double] <: Double
infix type %[X <: Double, Y <: Double] <: Double

/** Less-than comparison of two `Double` singleton types.
* ```scala
Expand All @@ -67,7 +67,7 @@ object double:
* ```
* @syntax markdown
*/
type <[X <: Double, Y <: Double] <: Boolean
infix type <[X <: Double, Y <: Double] <: Boolean

/** Greater-than comparison of two `Double` singleton types.
* ```scala
Expand All @@ -79,7 +79,7 @@ object double:
* ```
* @syntax markdown
*/
type >[X <: Double, Y <: Double] <: Boolean
infix type >[X <: Double, Y <: Double] <: Boolean

/** Greater-or-equal comparison of two `Double` singleton types.
* ```scala
Expand All @@ -91,7 +91,7 @@ object double:
* ```
* @syntax markdown
*/
type >=[X <: Double, Y <: Double] <: Boolean
infix type >=[X <: Double, Y <: Double] <: Boolean

/** Less-or-equal comparison of two `Double` singleton types.
* ```scala
Expand All @@ -103,7 +103,7 @@ object double:
* ```
* @syntax markdown
*/
type <=[X <: Double, Y <: Double] <: Boolean
infix type <=[X <: Double, Y <: Double] <: Boolean

/** Absolute value of an `Double` singleton type.
* ```scala
Expand All @@ -114,7 +114,7 @@ object double:
* ```
* @syntax markdown
*/
type Abs[X <: Double] <: Double
infix type Abs[X <: Double] <: Double

/** Negation of an `Double` singleton type.
* ```scala
Expand Down Expand Up @@ -181,4 +181,4 @@ object double:
* ```
* @syntax markdown
*/
type ToFloat[X <: Double] <: Float
type ToFloat[X <: Double] <: Float
18 changes: 9 additions & 9 deletions library/src/scala/compiletime/ops/float.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object float:
* ```
* @syntax markdown
*/
type +[X <: Float, Y <: Float] <: Float
infix type +[X <: Float, Y <: Float] <: Float

/** Subtraction of two `Float` singleton types.
* ```scala
Expand All @@ -22,7 +22,7 @@ object float:
* ```
* @syntax markdown
*/
type -[X <: Float, Y <: Float] <: Float
infix type -[X <: Float, Y <: Float] <: Float

/** Multiplication of two `Float` singleton types.
* ```scala
Expand All @@ -33,7 +33,7 @@ object float:
* ```
* @syntax markdown
*/
type *[X <: Float, Y <: Float] <: Float
infix type *[X <: Float, Y <: Float] <: Float

/** Integer division of two `Float` singleton types.
* ```scala
Expand All @@ -44,7 +44,7 @@ object float:
* ```
* @syntax markdown
*/
type /[X <: Float, Y <: Float] <: Float
infix type /[X <: Float, Y <: Float] <: Float

/** Remainder of the division of `X` by `Y`.
* ```scala
Expand All @@ -55,7 +55,7 @@ object float:
* ```
* @syntax markdown
*/
type %[X <: Float, Y <: Float] <: Float
infix type %[X <: Float, Y <: Float] <: Float

/** Less-than comparison of two `Float` singleton types.
* ```scala
Expand All @@ -67,7 +67,7 @@ object float:
* ```
* @syntax markdown
*/
type <[X <: Float, Y <: Float] <: Boolean
infix type <[X <: Float, Y <: Float] <: Boolean

/** Greater-than comparison of two `Float` singleton types.
* ```scala
Expand All @@ -79,7 +79,7 @@ object float:
* ```
* @syntax markdown
*/
type >[X <: Float, Y <: Float] <: Boolean
infix type >[X <: Float, Y <: Float] <: Boolean

/** Greater-or-equal comparison of two `Float` singleton types.
* ```scala
Expand All @@ -91,7 +91,7 @@ object float:
* ```
* @syntax markdown
*/
type >=[X <: Float, Y <: Float] <: Boolean
infix type >=[X <: Float, Y <: Float] <: Boolean

/** Less-or-equal comparison of two `Float` singleton types.
* ```scala
Expand All @@ -103,7 +103,7 @@ object float:
* ```
* @syntax markdown
*/
type <=[X <: Float, Y <: Float] <: Boolean
infix type <=[X <: Float, Y <: Float] <: Boolean

/** Absolute value of an `Float` singleton type.
* ```scala
Expand Down
26 changes: 13 additions & 13 deletions library/src/scala/compiletime/ops/int.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object int:
* ```
* @syntax markdown
*/
type +[X <: Int, Y <: Int] <: Int
infix type +[X <: Int, Y <: Int] <: Int

/** Subtraction of two `Int` singleton types.
* ```scala
Expand All @@ -40,7 +40,7 @@ object int:
* ```
* @syntax markdown
*/
type -[X <: Int, Y <: Int] <: Int
infix type -[X <: Int, Y <: Int] <: Int

/** Multiplication of two `Int` singleton types.
* ```scala
Expand All @@ -51,7 +51,7 @@ object int:
* ```
* @syntax markdown
*/
type *[X <: Int, Y <: Int] <: Int
infix type *[X <: Int, Y <: Int] <: Int

/** Integer division of two `Int` singleton types.
* ```scala
Expand All @@ -62,7 +62,7 @@ object int:
* ```
* @syntax markdown
*/
type /[X <: Int, Y <: Int] <: Int
infix type /[X <: Int, Y <: Int] <: Int

/** Remainder of the division of `X` by `Y`.
* ```scala
Expand All @@ -73,7 +73,7 @@ object int:
* ```
* @syntax markdown
*/
type %[X <: Int, Y <: Int] <: Int
infix type %[X <: Int, Y <: Int] <: Int

/** Binary left shift of `X` by `Y`.
* ```scala
Expand All @@ -84,7 +84,7 @@ object int:
* ```
* @syntax markdown
*/
type <<[X <: Int, Y <: Int] <: Int
infix type <<[X <: Int, Y <: Int] <: Int

/** Binary right shift of `X` by `Y`.
* ```scala
Expand All @@ -95,7 +95,7 @@ object int:
* ```
* @syntax markdown
*/
type >>[X <: Int, Y <: Int] <: Int
infix type >>[X <: Int, Y <: Int] <: Int

/** Binary right shift of `X` by `Y`, filling the left with zeros.
* ```scala
Expand All @@ -106,7 +106,7 @@ object int:
* ```
* @syntax markdown
*/
type >>>[X <: Int, Y <: Int] <: Int
infix type >>>[X <: Int, Y <: Int] <: Int

/** Bitwise xor of `X` and `Y`.
* ```scala
Expand All @@ -117,7 +117,7 @@ object int:
* ```
* @syntax markdown
*/
type ^[X <: Int, Y <: Int] <: Int
infix type ^[X <: Int, Y <: Int] <: Int

/** Less-than comparison of two `Int` singleton types.
* ```scala
Expand All @@ -129,7 +129,7 @@ object int:
* ```
* @syntax markdown
*/
type <[X <: Int, Y <: Int] <: Boolean
infix type <[X <: Int, Y <: Int] <: Boolean

/** Greater-than comparison of two `Int` singleton types.
* ```scala
Expand All @@ -141,7 +141,7 @@ object int:
* ```
* @syntax markdown
*/
type >[X <: Int, Y <: Int] <: Boolean
infix type >[X <: Int, Y <: Int] <: Boolean

/** Greater-or-equal comparison of two `Int` singleton types.
* ```scala
Expand All @@ -153,7 +153,7 @@ object int:
* ```
* @syntax markdown
*/
type >=[X <: Int, Y <: Int] <: Boolean
infix type >=[X <: Int, Y <: Int] <: Boolean

/** Less-or-equal comparison of two `Int` singleton types.
* ```scala
Expand All @@ -165,7 +165,7 @@ object int:
* ```
* @syntax markdown
*/
type <=[X <: Int, Y <: Int] <: Boolean
infix type <=[X <: Int, Y <: Int] <: Boolean

/** Bitwise and of `X` and `Y`.
* ```scala
Expand Down
Loading

0 comments on commit 8244d67

Please sign in to comment.