Skip to content

Fail at compile time if quote is not reified #6600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions library/src-3.x/scala/internal/Quoted.scala
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package scala.internal

import scala.annotation.Annotation
import scala.annotation.{Annotation, compileTimeOnly}
import scala.quoted._

object Quoted {

/** A term quote is desugared by the compiler into a call to this method */
def exprQuote[T](x: T): Expr[T] =
throw new Error("Internal error: this method call should have been replaced by the compiler")
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.exprQuote`")
def exprQuote[T](x: T): Expr[T] = ???

/** A term splice is desugared by the compiler into a call to this method */
def exprSplice[T](x: Expr[T]): T =
throw new Error("Internal error: this method call should have been replaced by the compiler")
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.exprSplice`")
def exprSplice[T](x: Expr[T]): T = ???

/** A type quote is desugared by the compiler into a call to this method */
def typeQuote[T <: AnyKind]: Type[T] =
throw new Error("Internal error: this method call should have been replaced by the compiler")
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.typeQuote`")
def typeQuote[T <: AnyKind]: Type[T] = ???

/** A splice in a quoted pattern is desugared by the compiler into a call to this method */
def patternHole[T]: T =
throw new Error("Internal error: this method call should have been replaced by the compiler")
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.patternHole`")
def patternHole[T]: T = ???

/** A splice of a name in a quoted pattern is desugared by wrapping getting this annotation */
@compileTimeOnly("Illegal reference to `scala.internal.Quoted.patternBindHole`")
class patternBindHole extends Annotation

}