Skip to content

Commit

Permalink
Refactor super type handling in checkAccessible
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym committed Mar 23, 2019
1 parent 4f419e7 commit 02ea347
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ trait Infer extends Checkable {
catch { case ex: MalformedType => malformed(ex, pre memberType underlyingSymbol(sym)) }
)
tree setSymbol sym1 setType (
pre match {
case _: SuperType =>
if (!sym.isConstructor && !owntype.isInstanceOf[OverloadedType]) owntype // OPT: avoid lambda allocation and Type.map
else owntype map ((tp: Type) => if (tp eq pre) site.symbol.thisType else tp)
case _ => owntype
pre match {
// OPT: avoid lambda allocation and Type.map for super constructor calls
case _: SuperType if !sym.isConstructor && !owntype.isInstanceOf[OverloadedType] =>
owntype map ((tp: Type) => if (tp eq pre) site.symbol.thisType else tp)
case _ => owntype
}
)
}
Expand Down

0 comments on commit 02ea347

Please sign in to comment.