-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
area:scalafix rulesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
A simple source with TravesableOnce
results in a strange IterableOnceIterableOnce
identifier (the correct identifier is repeated twice):
package com.github.ondrejspanel.scafi
object TraversableOnce {
def shuffle[T](random: scala.util.Random, src: TraversableOnce[T]): List[T] = {
src.foldLeft(List.empty[T]) { (list, item) =>
val len = list.length
val index = (random.nextDouble() * (len + 1)).toInt
list.patch(index, List(item), 0)
}
}
}
Using scalafix Collection213Upgrade
was rewritten as:
package com.github.ondrejspanel.scafi
import scala.IterableOnce
object TraversableOnce {
def shuffle[T](random: scala.util.Random, src: IterableOnceIterableOnce[T]): List[T] = {
src.foldLeft(List.empty[T]) { (list, item) =>
val len = list.length
val index = (random.nextDouble() * (len + 1)).toInt
list.patch(index, List(item), 0)
}
}
}
Complete project available at https://github.com/OndrejSpanel/ScalaFixSimple
Metadata
Metadata
Assignees
Labels
area:scalafix rulesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed