@@ -21,7 +21,7 @@ object GenColCompatHelper {
21
21
22
22
def genMain (targetDir : File , version : String , scalaVersion : String ): Seq [File ] = {
23
23
val content =
24
- if (scalaVersion startsWith " 2.13 " )
24
+ if (ScalaVersionHelper .isStdLibCompat_213(scalaVersion) )
25
25
""" /*
26
26
| * Copyright 2001-2018 Artima, Inc.
27
27
| *
@@ -53,7 +53,9 @@ object GenColCompatHelper {
53
53
|
54
54
| type Factory[-A, +C] = scala.collection.Factory[A, C]
55
55
|
56
- | object Factory {}
56
+ | object Factory {
57
+ | $$DOTTY_CONVERSION_METHODS$$
58
+ | }
57
59
|
58
60
| def className(col: scala.collection.Iterable[_]): String = {
59
61
| val colToString = col.toString
@@ -69,7 +71,10 @@ object GenColCompatHelper {
69
71
| type StringOps = scala.collection.StringOps
70
72
|}
71
73
|
72
- """ .stripMargin
74
+ """ .replaceAllLiterally(
75
+ " $$DOTTY_CONVERSION_METHODS$$" ,
76
+ if (ScalaVersionHelper .isDotty(scalaVersion)) dottyColCompatHelperFactoryMethods else " " )
77
+ .stripMargin
73
78
else
74
79
""" /*
75
80
| * Copyright 2001-2018 Artima, Inc.
@@ -137,9 +142,23 @@ object GenColCompatHelper {
137
142
)
138
143
}
139
144
145
+ private def dottyColCompatHelperFactoryMethods : String = """
146
+ | implicit def mkFactoryFromList[A]: Conversion[scala.collection.immutable.List.type, scala.collection.Factory[A, scala.collection.immutable.List[A]]] =
147
+ | scala.collection.IterableFactory.toFactory(_)
148
+ |
149
+ | implicit def mkFactoryFromVector[A]: Conversion[scala.collection.immutable.Vector.type, scala.collection.Factory[A, scala.collection.immutable.Vector[A]]] =
150
+ | scala.collection.IterableFactory.toFactory(_)
151
+ |
152
+ | implicit def mkFactoryFromSet[A]: Conversion[scala.collection.immutable.Set.type, scala.collection.Factory[A, scala.collection.immutable.Set[A]]] =
153
+ | scala.collection.IterableFactory.toFactory(_)
154
+ |
155
+ | implicit def mkFactoryFromListBuffer[A]: Conversion[scala.collection.mutable.ListBuffer.type, scala.collection.Factory[A, scala.collection.mutable.ListBuffer[A]]] =
156
+ | scala.collection.IterableFactory.toFactory(_)
157
+ """ .stripMargin
158
+
140
159
def genTest (targetDir : File , version : String , scalaVersion : String ): Seq [File ] = {
141
160
val chainSpec =
142
- if (scalaVersion startsWith " 2.13 " )
161
+ if (ScalaVersionHelper .isStdLibCompat_213(scalaVersion) )
143
162
""" /*
144
163
| * Copyright 2001-2018 Artima, Inc.
145
164
| *
@@ -213,7 +232,7 @@ object GenColCompatHelper {
213
232
""" .stripMargin
214
233
215
234
val everySpec =
216
- if (scalaVersion startsWith " 2.13 " )
235
+ if (ScalaVersionHelper .isStdLibCompat_213(scalaVersion) )
217
236
""" /*
218
237
| * Copyright 2001-2018 Artima, Inc.
219
238
| *
0 commit comments