Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87490e6

Browse files
committed
Avoid partition if not warning, add spaces
1 parent 4e2bc19 commit 87490e6

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

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

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -213,30 +213,28 @@ abstract class RefChecks extends Transform {
213213
else isCompetitive(syms, sawNlly, sawNonNlly)
214214
case _ => false
215215
})
216-
for ((_, syms) <- byName if syms.lengthCompare(1) > 0 && isCompetitive(syms, sawNlly=false, sawNonNlly=false)) {
217-
val (nullaries, alts) = syms.partition(sym => isNullary(sym.info))
218-
//assert(!alts.isEmpty)
219-
nullaries match {
220-
case nullary :: Nil =>
221-
if (warnable(syms))
222-
warnDubious(nullary, alts)
223-
case nullaries =>
224-
//assert(!nullaries.isEmpty)
225-
val dealiased =
226-
nullaries.find(_.isPrivateLocal) match {
227-
case Some(local) =>
228-
nullaries.find(sym => sym.isAccessor && sym.accessed == local) match {
229-
case Some(accessor) => nullaries.filter(_ != local) // drop local if it has an accessor
230-
case _ => nullaries
231-
}
232-
case _ => nullaries
233-
}
234-
// there are multiple exactly for a private local and an inherited member
235-
if (warnable(syms))
216+
for ((_, syms) <- byName)
217+
if (syms.lengthCompare(1) > 0 && isCompetitive(syms, sawNlly = false, sawNonNlly = false) && warnable(syms)) {
218+
val (nullaries, alts) = syms.partition(sym => isNullary(sym.info))
219+
//assert(!alts.isEmpty)
220+
nullaries match {
221+
case nullary :: Nil => warnDubious(nullary, alts)
222+
case nullaries =>
223+
//assert(!nullaries.isEmpty)
224+
val dealiased =
225+
nullaries.find(_.isPrivateLocal) match {
226+
case Some(local) =>
227+
nullaries.find(sym => sym.isAccessor && sym.accessed == local) match {
228+
case Some(accessor) => nullaries.filter(_ != local) // drop local if it has an accessor
229+
case _ => nullaries
230+
}
231+
case _ => nullaries
232+
}
233+
// there are multiple exactly for a private local and an inherited member
236234
for (nullary <- dealiased)
237235
warnDubious(nullary, nullary :: alts) // add (other) nullary to list of alts to show as overloads
236+
}
238237
}
239-
}
240238
}
241239

242240
// Override checking ------------------------------------------------------------

0 commit comments

Comments
 (0)