Skip to content

Commit 7b7f536

Browse files
committed
Create a test case that demonstrates a collision
1 parent b233d0c commit 7b7f536

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

scalafix-tests/input/src/main/scala/test/ReplaceSymbol.scala

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ patches.replaceSymbols = [
1212
to = "com.geirsson.mutable.CoolBuffer" }
1313
{ from = "scala.collection.mutable.HashMap"
1414
to = "com.geirsson.mutable.unsafe.CoolMap" }
15+
{ from = "scala.collection.immutable.TreeMap"
16+
to = "com.geirsson.immutable.SortedMap" }
1517
{ from = "scala.math.sqrt"
1618
to = "com.geirsson.fastmath.sqrt" }
1719
// normalized symbol renames all overloaded methods
@@ -29,6 +31,8 @@ patches.replaceSymbols = [
2931
*/
3032
package fix
3133

34+
import scala.collection.immutable.SortedMap
35+
import scala.collection.immutable.TreeMap
3236
import scala.collection.mutable.HashMap
3337
import scala.collection.mutable.ListBuffer
3438
import scala.collection.mutable
@@ -42,6 +46,7 @@ object ReplaceSymbol {
4246
"blah".substring(1)
4347
"blah".substring(1, 2)
4448
val u: mutable.HashMap[Int, Int] = HashMap.empty[Int, Int]
49+
val v: SortedMap[Int, Int] = TreeMap.empty[Int, Int]
4550
val x: ListBuffer[Int] = ListBuffer.empty[Int]
4651
val y: mutable.ListBuffer[Int] = mutable.ListBuffer.empty[Int]
4752
val z: scala.collection.mutable.ListBuffer[Int] =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.geirsson
2+
3+
import scala.collection.immutable.TreeMap
4+
5+
package object immutable {
6+
type SortedMap[A, B] = TreeMap[A, B]
7+
8+
object SortedMap {
9+
def empty[A : Ordering, B]: SortedMap[A, B] = TreeMap.empty[A, B]
10+
}
11+
}

scalafix-tests/output/src/main/scala/test/ReplaceSymbol.scala

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fix
22

3+
import scala.collection.immutable.SortedMap
34
import com.geirsson.Future
45
import com.geirsson.{ fastmath, mutable }
56
import com.geirsson.mutable.{ CoolBuffer, unsafe }
@@ -13,6 +14,7 @@ object ReplaceSymbol {
1314
"blah".substringFrom(1)
1415
"blah".substringBetween(1, 2)
1516
val u: unsafe.CoolMap[Int, Int] = CoolMap.empty[Int, Int]
17+
val v: SortedMap[Int, Int] = com.geirsson.immutable.SortedMap.empty[Int, Int]
1618
val x: CoolBuffer[Int] = CoolBuffer.empty[Int]
1719
val y: mutable.CoolBuffer[Int] = mutable.CoolBuffer.empty[Int]
1820
val z: com.geirsson.mutable.CoolBuffer[Int] =

0 commit comments

Comments
 (0)