Skip to content
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

Stabilize Quotes abort API #13312

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
16 changes: 4 additions & 12 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
* Emits an error and throws if the expression does not represent a value or possibly contains side effects.
* Otherwise returns the value.
*/
// TODO: deprecate in 3.1.0 and remove @experimental from valueOrAbort
// @deprecated("Use valueOrThrow", "3.1.0")
@deprecated("Use valueOrAbort", "3.1.0")
def valueOrError(using FromExpr[T]): T =
val fromExpr = summon[FromExpr[T]]
def reportError =
Expand All @@ -69,7 +68,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
* Emits an error and aborts if the expression does not represent a value or possibly contains side effects.
* Otherwise returns the value.
*/
@experimental
def valueOrAbort(using FromExpr[T]): T

end extension
Expand Down Expand Up @@ -4193,30 +4191,24 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def error(msg: String, pos: Position): Unit

/** Report an error at the position of the macro expansion and throw a StopMacroExpansion */
@experimental
def errorAndAbort(msg: String): Nothing

/** Report an error at the position of `expr` and throw a StopMacroExpansion */
@experimental
def errorAndAbort(msg: String, expr: Expr[Any]): Nothing

/** Report an error message at the given position and throw a StopMacroExpansion */
@experimental
def errorAndAbort(msg: String, pos: Position): Nothing

/** Report an error at the position of the macro expansion and throw a StopMacroExpansion */
// TODO: deprecate in 3.1.0 and remove @experimental from errorAndAbort
// @deprecated("Use errorAndAbort", "3.1.0")
@deprecated("Use errorAndAbort", "3.1.0")
def throwError(msg: String): Nothing

/** Report an error at the position of `expr` and throw a StopMacroExpansion */
// TODO: deprecate in 3.1.0 and remove @experimental from errorAndAbort
// @deprecated("Use errorAndAbort", "3.1.0")
@deprecated("Use errorAndAbort", "3.1.0")
def throwError(msg: String, expr: Expr[Any]): Nothing

/** Report an error message at the given position and throw a StopMacroExpansion */
// TODO: deprecate in 3.1.0 and remove @experimental from errorAndAbort
// @deprecated("Use errorAndAbort", "3.1.0")
@deprecated("Use errorAndAbort", "3.1.0")
def throwError(msg: String, pos: Position): Nothing

/** Report a warning at the position of the macro expansion */
Expand Down