Skip to content

Commit 882881b

Browse files
retronymmilessabin
authored andcommitted
Minor code cleanups in Contexts
1 parent c88c64e commit 882881b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/scala/tools/nsc/typechecker/Contexts.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ trait Contexts { self: Analyzer =>
249249
private type ImplicitDict = List[(Type, (Symbol, Tree))]
250250
private var implicitDictionary: ImplicitDict = null
251251

252-
def implicitRootContext: Context = {
252+
@tailrec final def implicitRootContext: Context = {
253253
if(implicitDictionary != null) this
254254
else if(outerIsNoContext || outer.openImplicits.isEmpty) {
255255
implicitDictionary = Nil
@@ -271,7 +271,7 @@ trait Contexts { self: Analyzer =>
271271
gen.mkAttributedRef(sym) setType tpe
272272
}
273273

274-
def linkByNameImplicit(tpe: Type): Tree = implicitRootContext.linkImpl(tpe)
274+
final def linkByNameImplicit(tpe: Type): Tree = implicitRootContext.linkImpl(tpe)
275275

276276
private def refImpl(tpe: Type): Tree =
277277
implicitDictionary.find(_._1 =:= tpe) match {
@@ -281,7 +281,7 @@ trait Contexts { self: Analyzer =>
281281
EmptyTree
282282
}
283283

284-
def refByNameImplicit(tpe: Type): Tree = implicitRootContext.refImpl(tpe)
284+
final def refByNameImplicit(tpe: Type): Tree = implicitRootContext.refImpl(tpe)
285285

286286
private def defineImpl(tpe: Type, result: SearchResult): SearchResult = {
287287
@tailrec
@@ -316,7 +316,7 @@ trait Contexts { self: Analyzer =>
316316
else prune(in.map(_._2) ++ trees, out, in ++ acc)
317317
}
318318

319-
val pruned = prune(List(result.tree), implicitDictionary.map(_._2), List.empty[(Symbol, Tree)])
319+
val pruned = prune(List(result.tree), implicitDictionary.map(_._2), Nil)
320320
if(pruned.isEmpty) result
321321
else {
322322
val (vsyms, vdefs) = pruned.map { case (vsym, rhs) =>

0 commit comments

Comments
 (0)