Skip to content

Commit 928f6b2

Browse files
committed
Update comment
1 parent c8c5e5a commit 928f6b2

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

+13-13
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import scala.annotation.constructorOnly
3636
* val x1 = ???
3737
* val x2 = ???
3838
* ...
39-
* ~{ ... '{ ... x1 ... x2 ...} ... }
39+
* ${ ... '{ ... x1 ... x2 ...} ... }
4040
* ...
4141
* }
4242
* ```
@@ -56,12 +56,12 @@ import scala.annotation.constructorOnly
5656
* val x1$1 = args(0).asInstanceOf[Expr[T]]
5757
* val x2$1 = args(1).asInstanceOf[Expr[T]] // can be asInstanceOf[Type[T]]
5858
* ...
59-
* { ... '{ ... x1$1.unary_~ ... x2$1.unary_~ ...} ... }
59+
* { ... '{ ... ${x1$1} ... ${x2$1} ...} ... }
6060
* }
6161
* )
6262
* )
6363
* ```
64-
* and then performs the same transformation on `'{ ... x1$1.unary_~ ... x2$1.unary_~ ...}`.
64+
* and then performs the same transformation on `'{ ... ${x1$1} ... ${x2$1} ...}`.
6565
*
6666
*/
6767
class ReifyQuotes extends MacroTransform {
@@ -95,9 +95,9 @@ class ReifyQuotes extends MacroTransform {
9595
* Returns a version of the reference that needs to be used in its place.
9696
* '{
9797
* val x = ???
98-
* { ... '{ ... x ... } ... }.unary_~
98+
* ${ ... '{ ... x ... } ... }
9999
* }
100-
* Eta expanding the `x` in `{ ... '{ ... x ... } ... }.unary_~` will return a `x$1.unary_~` for which the `x$1`
100+
* Eta expanding the `x` in `${ ... '{ ... x ... } ... }` will return a `${x$1}` for which the `x$1`
101101
* be created by some outer reifier.
102102
* This transformation is only applied to definitions at staging level 1.
103103
* See `isCaptured`.
@@ -113,11 +113,11 @@ class ReifyQuotes extends MacroTransform {
113113
new QuoteReifier(this, capturers, nestedEmbedded, ctx.owner)(ctx)
114114
}
115115

116-
/** Assuming <expr> contains types `<tag1>.unary_~, ..., <tagN>.unary_~`, the expression
116+
/** Assuming <expr> contains types `${<tag1>}, ..., ${<tagN>}`, the expression
117117
*
118-
* { type <Type1> = <tag1>.unary_~
118+
* { type <Type1> = ${<tag1>}
119119
* ...
120-
* type <TypeN> = <tagN>.unary_~
120+
* type <TypeN> = ${<tagN>}
121121
* <expr>
122122
* }
123123
*
@@ -133,7 +133,7 @@ class ReifyQuotes extends MacroTransform {
133133
val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs)
134134
val local = ctx.newSymbol(
135135
owner = ctx.owner,
136-
name = UniqueName.fresh((splicedTree.symbol.name.toString + "$_~").toTermName).toTypeName,
136+
name = UniqueName.fresh((splicedTree.symbol.name.toString + "$_").toTermName).toTypeName,
137137
flags = Synthetic,
138138
info = TypeAlias(splicedTree.tpe.select(tpnme.splice)),
139139
coord = spliced.termSymbol.coord).asType
@@ -178,7 +178,7 @@ class ReifyQuotes extends MacroTransform {
178178
else body match {
179179
case body: RefTree if isCaptured(body.symbol, level + 1) =>
180180
// Optimization: avoid the full conversion when capturing `x`
181-
// in '{ x } to '{ x$1.unary_~ } and go directly to `x$1`
181+
// in '{ x } to '{ ${x$1} } and go directly to `x$1`
182182
capturers(body.symbol)(body)
183183
case _=>
184184
val (body1, splices) = nested(isQuote = true).splitQuote(body)(quoteContext)
@@ -246,15 +246,15 @@ class ReifyQuotes extends MacroTransform {
246246
* '{
247247
* val x = ???
248248
* val y = ???
249-
* { ... '{ ... x .. y ... } ... }.unary_~
249+
* ${ ... '{ ... x .. y ... } ... }
250250
* }
251251
* then the spliced subexpression
252252
* { ... '{ ... x ... y ... } ... }
253253
* will be transformed to
254254
* (args: Seq[Any]) => {
255255
* val x$1 = args(0).asInstanceOf[Expr[Any]] // or .asInstanceOf[Type[Any]]
256256
* val y$1 = args(1).asInstanceOf[Expr[Any]] // or .asInstanceOf[Type[Any]]
257-
* { ... '{ ... x$1.unary_~ ... y$1.unary_~ ... } ... }
257+
* { ... '{ ... ${x$1} ... ${y$1} ... } ... }
258258
* }
259259
*
260260
* See: `capture`
@@ -347,7 +347,7 @@ class ReifyQuotes extends MacroTransform {
347347
reporting.trace(i"Reifier.transform $tree at $level", show = true) {
348348
tree match {
349349
case TypeApply(Select(spliceTree @ Spliced(_), _), tp) if tree.symbol.isTypeCast =>
350-
// Splice term which should be in the form `x.unary_~.asInstanceOf[T]` where T is an artefact of
350+
// Splice term which should be in the form `${x}.asInstanceOf[T]` where T is an artifact of
351351
// typer to allow pickling/unpickling phase consistent types
352352
transformSplice(spliceTree)
353353

compiler/src/dotty/tools/dotc/transform/Staging.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import scala.annotation.constructorOnly
2828

2929
/** Checks that the Phase Consistency Principle (PCP) holds and heals types.
3030
*
31-
* Type healing consists in transforming a phase inconsistent type `T` into `implicitly[Type[T]].unary_~`.
31+
* Type healing consists in transforming a phase inconsistent type `T` into `${ implicitly[Type[T]] }`.
3232
*/
3333
class Staging extends MacroTransform {
3434
import tpd._

compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ object PrepareInlineable {
288288
ctx.error(
289289
"""Malformed macro.
290290
|
291-
|Expected the ~ to be at the top of the RHS:
292-
| inline def foo(inline x: X, ..., y: Y): Int = ~impl(x, ... '(y))
291+
|Expected the splice ${...} to be at the top of the RHS:
292+
| inline def foo(inline x: X, ..., y: Y): Int = ${impl(x, ... '{y}})
293293
|
294294
| * The contents of the splice must call a static method
295295
| * All arguments must be quoted or inline

0 commit comments

Comments
 (0)