Skip to content

Commit ab2541a

Browse files
committed
Rename withNewQuoteContext to withQuoteContext
1 parent 9dc1087 commit ab2541a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+60
-60
lines changed

compiler/test-resources/repl-macros/i6007

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ scala> implicit def toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(ge
22
def toolbox: quoted.Toolbox
33
scala> val v = '{ (if true then Some(1) else None).map(v => v+1) }
44
val v: quoted.Expr[Option[Int]] = Expr(<pickled tasty>)
5-
scala> scala.quoted.withNewQuoteContext(v.show)
5+
scala> scala.quoted.withQuoteContext(v.show)
66
val res0: String = (if (true) scala.Some.apply[scala.Int](1) else scala.None).map[scala.Int](((v: scala.Int) => v.+(1)))
77
scala> scala.quoted.run(v)
88
val res1: Option[Int] = Some(2)

docs/docs/reference/metaprogramming/staging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ to be executed at a later stage. To run that code, there is another method
6161
in class `Expr` called `run`. Note that `$` and `run` both map from `Expr[T]`
6262
to `T` but only `$` is subject to the PCP, whereas `run` is just a normal method.
6363
Run provides a `QuoteContext` that can be used to show the expression in the scope of `run`.
64-
On the other hand `withNewQuoteContext` provides a `QuoteContext` without evauating the expression.
64+
On the other hand `withQuoteContext` provides a `QuoteContext` without evauating the expression.
6565

6666
```scala
6767
package scala.quoted
6868

6969
def run[T](expr: given QuoteContext => Expr[T]) given (toolbox: Toolbox): T = ...
7070

71-
def withNewQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = ...
71+
def withQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = ...
7272
```
7373

7474
## Example

library/src-3.x/scala/quoted/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ package object quoted {
2424
*
2525
* Usage:
2626
* ```
27-
* val e: T = withNewQuoteContext { // (given qctx: QuoteContext) =>
27+
* val e: T = withQuoteContext { // (given qctx: QuoteContext) =>
2828
* thunk
2929
* }
3030
* ```
3131
* where `thunk: T`
3232
*
3333
* This method shoul not be called in a context where there is already has a QuoteContext.
3434
*/
35-
def withNewQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = {
35+
def withQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = {
3636
var result: T = NoResult.asInstanceOf[T]
3737
def dummyRun given QuoteContext: Expr[Unit] = {
3838
result = thunk

tests/run-with-compiler/i3823-b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import scala.quoted._
22
object Test {
33
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
4-
def main(args: Array[String]): Unit = withNewQuoteContext {
4+
def main(args: Array[String]): Unit = withQuoteContext {
55
def f[T](x: Expr[T])(implicit t: Type[T]) = '{
66
val z: $t = $x
77
}

tests/run-with-compiler/i3823-c.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import scala.quoted._
22
object Test {
33
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
4-
def main(args: Array[String]): Unit = withNewQuoteContext {
4+
def main(args: Array[String]): Unit = withQuoteContext {
55
def f[T](x: Expr[T])(implicit t: Type[T]) = '{
66
val z = $x
77
}

tests/run-with-compiler/i3823.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import scala.quoted._
22
object Test {
33
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
4-
def main(args: Array[String]): Unit = withNewQuoteContext {
4+
def main(args: Array[String]): Unit = withQuoteContext {
55
def f[T: Type](x: Expr[T])(t: Type[T]) = '{
66
val z: $t = $x
77
}

tests/run-with-compiler/i3847-b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Arrays {
1414

1515
object Test {
1616
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
17-
def main(args: Array[String]): Unit = withNewQuoteContext {
17+
def main(args: Array[String]): Unit = withQuoteContext {
1818
import Arrays._
1919
implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int}
2020
val arr: Expr[Array[List[Int]]] = Array[List[Int]](List(1, 2, 3)).toExpr

tests/run-with-compiler/i3847.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Arrays {
1414

1515
object Test {
1616
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
17-
def main(args: Array[String]): Unit = withNewQuoteContext {
17+
def main(args: Array[String]): Unit = withQuoteContext {
1818
import Arrays._
1919
implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int}
2020
val arr: Expr[Array[Int]] = Array[Int](1, 2, 3).toExpr

tests/run-with-compiler/i3876-b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ object Test {
1111
}
1212

1313
println(run(f2(x)))
14-
println(withNewQuoteContext(f2(x).show))
14+
println(withQuoteContext(f2(x).show))
1515
}
1616
}

tests/run-with-compiler/i3876-c.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ object Test {
1111
}
1212

1313
println(run(f3(x)))
14-
println(withNewQuoteContext(f3(x).show)) // TODO improve printer
14+
println(withQuoteContext(f3(x).show)) // TODO improve printer
1515
}
1616
}

0 commit comments

Comments
 (0)