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