Skip to content

Commit 69281ae

Browse files
committed
Refactor internal.Quoted
* Move it to `scala.internal.quoted` * Rename to `CompileTime`
1 parent 0f4a359 commit 69281ae

File tree

9 files changed

+143
-93
lines changed

9 files changed

+143
-93
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ class Definitions {
682682
@tu lazy val LiftableModule_CharIsLiftable: Symbol = LiftableModule.requiredMethod("CharIsLiftable")
683683
@tu lazy val LiftableModule_StringIsLiftable: Symbol = LiftableModule.requiredMethod("StringIsLiftable")
684684

685-
@tu lazy val InternalQuotedModule: Symbol = ctx.requiredModule("scala.internal.Quoted")
685+
@tu lazy val InternalQuotedModule: Symbol = ctx.requiredModule("scala.internal.quoted.CompileTime")
686686
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("exprQuote")
687687
@tu lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("exprSplice")
688688
@tu lazy val InternalQuoted_typeQuote : Symbol = InternalQuotedModule.requiredMethod("typeQuote")

library/src/scala/internal/Quoted.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
// TODO remove when reference compiler is updated
12
package scala.internal
23

34
import scala.annotation.{Annotation, compileTimeOnly}
45
import scala.quoted._
56

67
@compileTimeOnly("Illegal reference to `scala.internal.Quoted`")
8+
@deprecated("Use scala.internal.quoted.CompileTime", "0.22.0")
79
object Quoted {
810

911
/** A term quote is desugared by the compiler into a call to this method */
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package scala.internal.quoted
2+
3+
import scala.annotation.{Annotation, compileTimeOnly}
4+
import scala.quoted._
5+
6+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime`")
7+
object CompileTime {
8+
9+
/** A term quote is desugared by the compiler into a call to this method */
10+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprQuote`")
11+
def exprQuote[T](x: T): (given QuoteContext) => Expr[T] = ???
12+
13+
/** A term splice is desugared by the compiler into a call to this method */
14+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprSplice`")
15+
def exprSplice[T](x: (given QuoteContext) => Expr[T]): T = ???
16+
17+
/** A type quote is desugared by the compiler into a call to this method */
18+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.typeQuote`")
19+
def typeQuote[T <: AnyKind]: Type[T] = ???
20+
21+
/** A splice in a quoted pattern is desugared by the compiler into a call to this method */
22+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternHole`")
23+
def patternHole[T]: T = ???
24+
25+
/** A splice of a name in a quoted pattern is desugared by wrapping getting this annotation */
26+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternBindHole`")
27+
class patternBindHole extends Annotation
28+
29+
/** A splice of a name in a quoted pattern is that marks the definition of a type splice */
30+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternType`")
31+
class patternType extends Annotation
32+
33+
/** A type pattern that must be aproximated from above */
34+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.fromAbove`")
35+
class fromAbove extends Annotation
36+
37+
/** Artifact of pickled type splices
38+
*
39+
* During quote reification a quote `'{ ... F[$t] ... }` will be transformed into
40+
* `'{ @quoteTypeTag type T$1 = $t ... F[T$1] ... }` to have a tree for `$t`.
41+
* This artifact is removed during quote unpickling.
42+
*
43+
* See ReifyQuotes.scala and PickledQuotes.scala
44+
*/
45+
@compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.quoteTypeTag`")
46+
class quoteTypeTag extends Annotation
47+
48+
}

0 commit comments

Comments
 (0)