diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2013-06-27 14:37:56 +0200 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2013-06-27 22:34:03 +0200 |
commit | ed7f488465a036d55959a7136fffa9c622d43eac (patch) | |
tree | 60d36629111200159ae1e134832d404a9da91667 | |
parent | be436ba8ab6c50795d7a9d6ea525b6e32faf532d (diff) | |
download | scala-ed7f488465a036d55959a7136fffa9c622d43eac.tar.gz scala-ed7f488465a036d55959a7136fffa9c622d43eac.tar.bz2 scala-ed7f488465a036d55959a7136fffa9c622d43eac.zip |
GenBCode: Eliminate needless Options
This commit brings GenBCode in line with "Eliminate needless Options"
as promoted by https://github.com/scala/scala/commit/45d61774eb255416c96e983cdb87960ad6415b74
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala index cf34911f88..542a90fa85 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala @@ -337,9 +337,9 @@ abstract class BCodeTypes extends BCodeIdiomatic { def getSuperInterfaces(csym: Symbol): List[Symbol] = { // Additional interface parents based on annotations and other cues - def newParentForAttr(attr: Symbol): Option[Symbol] = attr match { - case definitions.RemoteAttr => Some(definitions.RemoteInterfaceClass) - case _ => None + def newParentForAttr(ann: AnnotationInfo): Symbol = ann.symbol match { + case definitions.RemoteAttr => definitions.RemoteInterfaceClass + case _ => NoSymbol } /* Drop redundant interfaces (which are implemented by some other parent) from the immediate parents. @@ -362,11 +362,7 @@ abstract class BCodeTypes extends BCodeIdiomatic { } val superInterfaces0: List[Symbol] = csym.mixinClasses - val superInterfaces: List[Symbol] = { - val sups = (superInterfaces0 ++ csym.annotations.flatMap(ann => newParentForAttr(ann.symbol))) - - sups.distinct - }; + val superInterfaces = existingSymbols(superInterfaces0 ++ csym.annotations.map(newParentForAttr)).distinct assert(!superInterfaces.contains(NoSymbol), s"found NoSymbol among: ${superInterfaces.mkString}") assert(superInterfaces.forall(s => s.isInterface || s.isTrait), s"found non-interface among: ${superInterfaces.mkString}") |