@@ -95,28 +95,16 @@ package object compiletime {
95
95
// implemented in dotty.tools.dotc.typer.Inliner
96
96
error(" Compiler bug: `constValue` was not evaluated by the compiler" )
97
97
98
- /**
99
- * Use this type to widen a self-type to a tuple. E.g.
100
- * ```
101
- * val x: (1, 3) = (1, 3)
102
- * val y: Widen[x.type] = x
103
- * ```
104
- */
105
- type Widen [Tup <: Tuple ] <: Tuple = Tup match {
106
- case EmptyTuple => EmptyTuple
107
- case h *: t => h *: t
108
- }
109
-
110
98
/** Given a tuple type `(X1, ..., Xn)`, returns a tuple value
111
99
* `(constValue[X1], ..., constValue[Xn])`.
112
100
*/
113
- inline def constValueTuple [T <: Tuple ]: Widen [ T ] =
101
+ inline def constValueTuple [T <: Tuple ]: T =
114
102
val res =
115
103
inline erasedValue[T ] match
116
104
case _ : EmptyTuple => EmptyTuple
117
105
case _ : (t *: ts) => constValue[t] *: constValueTuple[ts]
118
106
end match
119
- res.asInstanceOf [Widen [ T ] ]
107
+ res.asInstanceOf [T ]
120
108
end constValueTuple
121
109
122
110
/** Summons first given matching one of the listed cases. E.g. in
@@ -151,16 +139,16 @@ package object compiletime {
151
139
* @tparam T the tuple containing the types of the values to be summoned
152
140
* @return the given values typed as elements of the tuple
153
141
*/
154
- inline def summonAll [T <: Tuple ]: Widen [ T ] =
142
+ inline def summonAll [T <: Tuple ]: T =
155
143
val res =
156
144
inline erasedValue[T ] match
157
145
case _ : EmptyTuple => EmptyTuple
158
146
case _ : (t *: ts) => summonInline[t] *: summonAll[ts]
159
147
end match
160
- res.asInstanceOf [Widen [ T ] ]
148
+ res.asInstanceOf [T ]
161
149
end summonAll
162
150
163
- /** Succesor of a natural number where zero is the type 0 and successors are reduced as if the definition was
151
+ /** Successor of a natural number where zero is the type 0 and successors are reduced as if the definition was
164
152
*
165
153
* type S[N <: Int] <: Int = N match {
166
154
* case 0 => 1
0 commit comments