Skip to content

Improve quoted.runtime docs #10590

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 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions library/src/scala/quoted/runtime/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ import scala.annotation.{Annotation, compileTimeOnly}
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr`")
object Expr:

/** A term quote is desugared by the compiler into a call to this method */
/** A term quote is desugared by the compiler into a call to this method
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.quote`")
def quote[T](x: T): Quotes ?=> scala.quoted.Expr[T] = ???

/** A term splice is desugared by the compiler into a call to this method */
/** A term splice is desugared by the compiler into a call to this method
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.splice`")
def splice[T](x: Quotes ?=> scala.quoted.Expr[T]): T = ???

/** A term splice nested within a quote is desugared by the compiler into a call to this method.
* `ctx` is the `Quotes` that the quote of this splice uses.
*/
* `ctx` is the `Quotes` that the quote of this splice uses.
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.nestedSplice`")
def nestedSplice[T](q: Quotes)(x: q.Nested ?=> scala.quoted.Expr[T]): T = ???
25 changes: 20 additions & 5 deletions library/src/scala/quoted/runtime/Patterns.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,38 @@ import scala.annotation.{Annotation, compileTimeOnly}
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns`")
object Patterns {

/** A splice in a quoted pattern is desugared by the compiler into a call to this method */
/** A splice in a quoted pattern is desugared by the compiler into a call to this method.
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternHole`")
def patternHole[T]: T = ???

/** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method.
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternHigherOrderHole`")
/** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method */
def patternHigherOrderHole[U](pat: Any, args: Any*): U = ???

/** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method.
*
* Calling this method in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.higherOrderHole`")
/** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method */
def higherOrderHole[U](args: Any*): U = ???

/** A splice of a name in a quoted pattern is that marks the definition of a type splice */
/** A splice of a name in a quoted pattern is that marks the definition of a type splice.
*
* Adding this annotation in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternType`")
class patternType extends Annotation

/** A type pattern that must be aproximated from above */
/** A type pattern that must be aproximated from above
*
* Adding this annotation in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.fromAbove`")
class fromAbove extends Annotation

Expand Down
2 changes: 2 additions & 0 deletions library/src/scala/quoted/runtime/SplicedType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import scala.annotation.{Annotation, compileTimeOnly}
* This artifact is removed during quote unpickling.
*
* See PickleQuotes.scala and PickledQuotes.scala
*
* Adding this annotation in source has undefined behaviour at compile-time
*/
@compileTimeOnly("Illegal reference to `scala.quoted.runtime.SplicedType`")
class SplicedType extends Annotation