Skip to content

Commit ba0f746

Browse files
committed
Update bootstrap library to new syntax
1 parent 67dcf2a commit ba0f746

File tree

7 files changed

+109
-109
lines changed

7 files changed

+109
-109
lines changed

docs/docs/reference/other-new-features/principled-meta-programming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ implementation of power otherwise.
783783
This assumes a `Constant` extractor that maps tree nodes representing
784784
constants to their values.
785785

786-
With the right extractors, the "AsFunction" operation
786+
With the right extractors, the "AsFunction" conversion
787787
that maps expressions over functions to functions over expressions can
788788
be implemented in user code:
789789
```scala

docs/docs/reference/other-new-features/tasty-reflect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To provide reflection capabilities in macros we need to add an implicit paramete
2424
import scala.quoted._
2525
import scala.tasty._
2626

27-
inline def natConst(x: Int): Int = ~natConstImpl('(x))
27+
inline def natConst(x: Int): Int = ~natConstImpl('{x})
2828

2929
def natConstImpl(x: Expr[Int])(implicit reflection: Reflection): Expr[Int] = {
3030
import reflection._

library/src-bootstrapped/scala/StagedTuple.scala

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

library/src-bootstrapped/scala/Tuple.scala

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sealed trait Tuple extends Any {
1010
if (stageIt) stagedToArray
1111
else inline constValueOpt[BoundedSize[this.type]] match {
1212
case Some(0) =>
13-
$emptyArray
13+
empty$Array
1414
case Some(1) =>
1515
val t = asInstanceOf[Tuple1[Object]]
1616
Array(t._1)
@@ -24,15 +24,15 @@ sealed trait Tuple extends Any {
2424
val t = asInstanceOf[Tuple4[Object, Object, Object, Object]]
2525
Array(t._1, t._2, t._3, t._4)
2626
case Some(n) if n <= $MaxSpecialized =>
27-
$toArray(this, n)
27+
to$Array(this, n)
2828
case Some(n) =>
2929
asInstanceOf[TupleXXL].elems
3030
case None =>
3131
dynamicToArray(this)
3232
}
3333

3434
inline def stagedToArray: Array[Object] =
35-
~StagedTuple.toArrayStaged('(this), constValueOpt[BoundedSize[this.type]])
35+
${ StagedTuple.toArrayStaged('{this}, constValueOpt[BoundedSize[this.type]]) }
3636

3737
inline def *: [H] (x: H): H *: this.type =
3838
if (stageIt) stagedCons[H](x)
@@ -53,14 +53,14 @@ sealed trait Tuple extends Any {
5353
val t = asInstanceOf[Tuple4[_, _, _, _]]
5454
Tuple5(x, t._1, t._2, t._3, t._4).asInstanceOf[Result]
5555
case Some(n) =>
56-
fromArray[Result]($consArray(x, toArray))
56+
fromArray[Result](cons$Array(x, toArray))
5757
case _ =>
5858
dynamic_*:[this.type, H](this, x)
5959
}
6060
}
6161

6262
inline def stagedCons[H] (x: H): H *: this.type =
63-
~StagedTuple.stagedCons('(this), '(x), constValueOpt[BoundedSize[this.type]])
63+
${ StagedTuple.stagedCons('{this}, '{x}, constValueOpt[BoundedSize[this.type]]) }
6464

6565
inline def ++(that: Tuple): Concat[this.type, that.type] =
6666
if (stageIt) stagedConcat(that)
@@ -104,8 +104,8 @@ sealed trait Tuple extends Any {
104104
}
105105

106106
inline def stagedConcat(that: Tuple): Concat[this.type, that.type] =
107-
~StagedTuple.stagedConcat('(this), constValueOpt[BoundedSize[this.type]],
108-
'(that), constValueOpt[BoundedSize[that.type]])
107+
${ StagedTuple.stagedConcat('{this}, constValueOpt[BoundedSize[this.type]],
108+
'{that}, constValueOpt[BoundedSize[that.type]]) }
109109

110110
inline def genericConcat[T <: Tuple](xs: Tuple, ys: Tuple): Tuple =
111111
fromArray[T](xs.toArray ++ ys.toArray)
@@ -121,7 +121,7 @@ sealed trait Tuple extends Any {
121121
}
122122

123123
inline def stagedSize: Size[this.type] =
124-
~StagedTuple.sizeStaged[Size[this.type]]('(this), constValueOpt[BoundedSize[this.type]])
124+
${ StagedTuple.sizeStaged[Size[this.type]]('{this}, constValueOpt[BoundedSize[this.type]]) }
125125
}
126126

127127
object Tuple {
@@ -167,9 +167,9 @@ object Tuple {
167167

168168
private[scala] type BoundedSize[X] = BoundedSizeRecur[X, 23]
169169

170-
val $emptyArray = Array[Object]()
170+
val empty$Array = Array[Object]()
171171

172-
def $toArray(xs: Tuple, n: Int) = {
172+
def to$Array(xs: Tuple, n: Int) = {
173173
val arr = new Array[Object](n)
174174
var i = 0
175175
var it = xs.asInstanceOf[Product].productIterator
@@ -180,7 +180,7 @@ object Tuple {
180180
arr
181181
}
182182

183-
def $consArray[H](x: H, elems: Array[Object]): Array[Object] = {
183+
def cons$Array[H](x: H, elems: Array[Object]): Array[Object] = {
184184
val elems1 = new Array[Object](elems.length + 1)
185185
elems1(0) = x.asInstanceOf[Object]
186186
System.arraycopy(elems, 0, elems1, 1, elems.length)
@@ -217,7 +217,7 @@ object Tuple {
217217
}
218218

219219
inline def stagedFromArray[T <: Tuple](xs: Array[Object]): T =
220-
~StagedTuple.fromArrayStaged[T]('(xs), constValueOpt[BoundedSize[this.type]])
220+
${ StagedTuple.fromArrayStaged[T]('{xs}, constValueOpt[BoundedSize[this.type]]) }
221221

222222
def dynamicFromArray[T <: Tuple](xs: Array[Object]): T = xs.length match {
223223
case 0 => ().asInstanceOf[T]
@@ -248,7 +248,7 @@ object Tuple {
248248

249249
def dynamicToArray(self: Tuple): Array[Object] = (self: Any) match {
250250
case self: Unit =>
251-
$emptyArray
251+
empty$Array
252252
case self: Tuple1[_] =>
253253
val t = self.asInstanceOf[Tuple1[Object]]
254254
Array(t._1)
@@ -283,7 +283,7 @@ object Tuple {
283283
case self: Tuple4[_, _, _, _] =>
284284
Tuple5(x, self._1, self._2, self._3, self._4).asInstanceOf[Result]
285285
case _ =>
286-
dynamicFromArray[Result]($consArray(x, dynamicToArray(self)))
286+
dynamicFromArray[Result](cons$Array(x, dynamicToArray(self)))
287287
}
288288
}
289289

@@ -340,7 +340,7 @@ sealed trait NonEmptyTuple extends Tuple {
340340
}
341341

342342
inline def stagedHead: Head[this.type] =
343-
~StagedTuple.headStaged[this.type]('(this), constValueOpt[BoundedSize[this.type]])
343+
${ StagedTuple.headStaged[this.type]('{this}, constValueOpt[BoundedSize[this.type]]) }
344344

345345
inline def tail: Tail[this.type] =
346346
if (stageIt) stagedTail
@@ -369,7 +369,7 @@ sealed trait NonEmptyTuple extends Tuple {
369369
}
370370

371371
inline def stagedTail: Tail[this.type] =
372-
~StagedTuple.tailStaged[this.type]('(this), constValueOpt[BoundedSize[this.type]])
372+
${ StagedTuple.tailStaged[this.type]('{this}, constValueOpt[BoundedSize[this.type]]) }
373373

374374
inline def fallbackApply(n: Int) =
375375
inline constValueOpt[n.type] match {
@@ -429,9 +429,9 @@ sealed trait NonEmptyTuple extends Tuple {
429429
}
430430

431431
inline def stagedApply(n: Int): Elem[this.type, n.type] =
432-
~StagedTuple.applyStaged[this.type, n.type](
433-
'(this), constValueOpt[Size[this.type]],
434-
'(n), constValueOpt[n.type])
432+
${ StagedTuple.applyStaged[this.type, n.type](
433+
'{this}, constValueOpt[Size[this.type]],
434+
'{n}, constValueOpt[n.type]) }
435435
}
436436

437437
object NonEmptyTuple {

library/src-bootstrapped/scala/quoted/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package object quoted {
1010
def toExprOfList(implicit ev: Type[T]): Expr[List[T]] = {
1111
def rec(list: List[Expr[T]]): Expr[List[T]] = list match {
1212
case x :: xs => '{ (~x) :: (~rec(xs)) }
13-
case Nil => '(Nil)
13+
case Nil => '{Nil}
1414
}
1515
rec(list)
1616
}

library/src-bootstrapped/scala/tasty/reflect/utils/TreeUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait TreeUtils {
1414
val rhsExpr = rhs.seal[T]
1515
val expr = '{
1616
val x = ~rhsExpr
17-
~in(('(x)).unseal.asInstanceOf[Term.Ident]).seal[Any]
17+
${ in(('{x}).unseal.asInstanceOf[Term.Ident]).seal[Any] }
1818
}
1919
expr.unseal
2020
}

library/src/scala/quoted/Liftable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package scala.quoted
33
import scala.runtime.quoted.Unpickler.liftedExpr
44

55
/** A typeclass for types that can be turned to `quoted.Expr[T]`
6-
* without going through an explicit `'(...)` operation.
6+
* without going through an explicit `'{...}` operation.
77
*/
88
abstract class Liftable[T] {
99
def toExpr(x: T): Expr[T]

0 commit comments

Comments
 (0)