Skip to content

Commit 7a99d3d

Browse files
Merge pull request #7930 from dotty-staging/refactor-internal-Quoted
Add missing compileTimeOnly annotations
2 parents 85f93bf + 69281ae commit 7a99d3d

File tree

9 files changed

+147
-94
lines changed

9 files changed

+147
-94
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ class Definitions {
687687
@tu lazy val LiftableModule_CharIsLiftable: Symbol = LiftableModule.requiredMethod("CharIsLiftable")
688688
@tu lazy val LiftableModule_StringIsLiftable: Symbol = LiftableModule.requiredMethod("StringIsLiftable")
689689

690-
@tu lazy val InternalQuotedModule: Symbol = ctx.requiredModule("scala.internal.Quoted")
690+
@tu lazy val InternalQuotedModule: Symbol = ctx.requiredModule("scala.internal.quoted.CompileTime")
691691
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("exprQuote")
692692
@tu lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("exprSplice")
693693
@tu lazy val InternalQuoted_typeQuote : Symbol = InternalQuotedModule.requiredMethod("typeQuote")

library/src/scala/internal/Quoted.scala

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +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

7+
@compileTimeOnly("Illegal reference to `scala.internal.Quoted`")
8+
@deprecated("Use scala.internal.quoted.CompileTime", "0.22.0")
69
object Quoted {
710

811
/** A term quote is desugared by the compiler into a call to this method */
@@ -26,9 +29,11 @@ object Quoted {
2629
class patternBindHole extends Annotation
2730

2831
/** A splice of a name in a quoted pattern is that marks the definition of a type splice */
32+
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.patternType`")
2933
class patternType extends Annotation
3034

3135
/** A type pattern that must be aproximated from above */
36+
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.fromAbove`")
3237
class fromAbove extends Annotation
3338

3439
/** Artifact of pickled type splices
@@ -39,7 +44,7 @@ object Quoted {
3944
*
4045
* See ReifyQuotes.scala and PickledQuotes.scala
4146
*/
42-
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.patternBindHole`")
47+
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.quoteTypeTag`")
4348
class quoteTypeTag extends Annotation
4449

4550
}
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)