Skip to content

Commit

Permalink
GenBCode: Eliminate needless Options
Browse files Browse the repository at this point in the history
This commit brings GenBCode in line with "Eliminate needless Options"
as promoted by scala@45d6177
  • Loading branch information
magarciaEPFL committed Jun 27, 2013
1 parent 334bc76 commit af6d1ec
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
Expand Up @@ -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.
Expand All @@ -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}")
Expand Down

0 comments on commit af6d1ec

Please sign in to comment.