Skip to content

Remove show extension workaround #10501

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
Nov 26, 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
10 changes: 4 additions & 6 deletions compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ object QuotesImpl {
def apply()(using Context): Quotes =
new QuotesImpl

def showDecompiledTree(tree: tpd.Tree)(using Context): String = {
def showDecompiledTree(tree: tpd.Tree)(using Context): String =
import qctx.reflect.TreeMethodsImpl.{showAnsiColored, show}
val qctx: QuotesImpl = new QuotesImpl(using MacroExpansion.context(tree))
if ctx.settings.color.value == "always" then
qctx.reflect.TreeMethodsImpl.temporaryShowAnsiColored(tree)
else
qctx.reflect.TreeMethodsImpl.temporaryShow(tree)
}
if ctx.settings.color.value == "always" then showAnsiColored(tree)
else show(tree)

// TODO Explore more fine grained scope ids.
// This id can only differentiate scope extrusion from one compiler instance to another.
Expand Down
3 changes: 0 additions & 3 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
protected val TreeMethodsImpl: TreeMethods

trait TreeMethods {
// Dodo: Drop once extension methods have stabilized
def temporaryShowAnsiColored(self: Tree): String = self.showAnsiColored
def temporaryShow(self: Tree): String = self.show

extension (self: Tree):
/** Position in the source code */
Expand Down