Skip to content

Remove dead code in Bridges #4091

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
Mar 9, 2018
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
20 changes: 9 additions & 11 deletions compiler/src/dotty/tools/dotc/transform/Bridges.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ class Bridges(root: ClassSymbol)(implicit ctx: Context) {
/** Add all necessary bridges to template statements `stats`, and remove at the same
* time deferred methods in `stats` that are replaced by a bridge with the same signature.
*/
def add(stats: List[untpd.Tree]): List[untpd.Tree] =
if (root.is(Trait)) stats
else {
val opc = new BridgesCursor()(preErasureCtx)
while (opc.hasNext) {
if (!opc.overriding.is(Deferred)) addBridgeIfNeeded(opc.overriding, opc.overridden)
opc.next()
}
if (bridges.isEmpty) stats
else stats.filterNot(stat => toBeRemoved contains stat.symbol) ::: bridges.toList
def add(stats: List[untpd.Tree]): List[untpd.Tree] = {
val opc = new BridgesCursor()(preErasureCtx)
while (opc.hasNext) {
if (!opc.overriding.is(Deferred)) addBridgeIfNeeded(opc.overriding, opc.overridden)
opc.next()
}
}
if (bridges.isEmpty) stats
else stats.filterNot(stat => toBeRemoved contains stat.symbol) ::: bridges.toList
}
}
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/transform/Erasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ object Erasure {
}
}

override def typedTypeDef(tdef: untpd.TypeDef, sym: Symbol)(implicit ctx: Context) =
override def typedTypeDef(tdef: untpd.TypeDef, sym: Symbol)(implicit ctx: Context): Tree =
EmptyTree

override def typedStats(stats: List[untpd.Tree], exprOwner: Symbol)(implicit ctx: Context): List[Tree] = {
Expand All @@ -684,8 +684,8 @@ object Erasure {
}

override def simplify(tree: Tree, pt: Type, locked: TypeVars)(implicit ctx: Context): tree.type = tree
}
}

def takesBridges(sym: Symbol)(implicit ctx: Context) =
private def takesBridges(sym: Symbol)(implicit ctx: Context): Boolean =
sym.isClass && !sym.is(Flags.Trait | Flags.Package)
}