Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mucciolo committed Nov 26, 2022
1 parent 329e1ad commit d7006e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
18 changes: 8 additions & 10 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3475,28 +3475,26 @@ object Types {
*/
private def gatherTreeUniqueMembersAbsorbingNothingTypes(using Context): MutableSet[Type] = {

var trees = List(this)
var unvisitedSubtrees = List(this)
val uniqueTreeMembers = new EqLinkedHashSet[Type]

while (trees.nonEmpty) {
trees match {
while (unvisitedSubtrees.nonEmpty) {
unvisitedSubtrees match
case head :: tail =>
head match {
head match
case OrType(l: OrType, r: OrType) =>
trees = l :: r :: tail
unvisitedSubtrees = l :: r :: tail
case OrType(l, r: OrType) =>
trees = r :: tail
unvisitedSubtrees = r :: tail
if !l.isNothingType then uniqueTreeMembers += l
case OrType(l: OrType, r) =>
trees = l :: tail
unvisitedSubtrees = l :: tail
if !r.isNothingType then uniqueTreeMembers += r
case OrType(l, r) =>
trees = tail
unvisitedSubtrees = tail
uniqueTreeMembers += l
if !r.isNothingType then uniqueTreeMembers += r
}
case _ =>
}
}

uniqueTreeMembers
Expand Down
12 changes: 0 additions & 12 deletions compiler/src/dotty/tools/dotc/util/EqLinkedHashSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,3 @@ class EqLinkedHashSet[T](
override def iterator: Iterator[T] = linkingArray.iterator

}

object EqLinkedHashSet {
def apply[T](x: T): EqLinkedHashSet[T] =
val set = new EqLinkedHashSet[T]
set += x
set

def apply[T](x: T, y: T): EqLinkedHashSet[T] =
val set = EqLinkedHashSet(x)
set += y
set
}

0 comments on commit d7006e1

Please sign in to comment.