Skip to content

Cleanup InterceptedMethods #4089

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 2 commits into from
Mar 9, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,15 @@ class InterceptedMethods extends MiniPhase {

private[this] var primitiveGetClassMethods: Set[Symbol] = _

var Any_## : Symbol = _ // cached for performance reason

/** perform context-dependant initialization */
override def prepareForUnit(tree: Tree)(implicit ctx: Context) = {
this.Any_## = defn.Any_##
primitiveGetClassMethods = Set[Symbol]() ++ defn.ScalaValueClasses().map(x => x.requiredMethod(nme.getClass_))
ctx
}

// this should be removed if we have guarantee that ## will get Apply node
override def transformSelect(tree: tpd.Select)(implicit ctx: Context): Tree = {
if (tree.symbol.isTerm && (Any_## eq tree.symbol.asTerm)) {
if (tree.symbol.isTerm && (defn.Any_## eq tree.symbol.asTerm)) {
val rewrite = poundPoundValue(tree.qualifier)
ctx.log(s"$phaseName rewrote $tree to $rewrite")
rewrite
Expand Down Expand Up @@ -92,11 +89,8 @@ class InterceptedMethods extends MiniPhase {
}

}
val Any_## = this.Any_##
val Any_!= = defn.Any_!=
val rewrite: Tree = tree.fun.symbol match {
case Any_## =>
poundPoundValue(qual)
case Any_!= =>
qual.select(defn.Any_==).appliedToArgs(tree.args).select(defn.Boolean_!)
/*
Expand Down