-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for Scala 2 varargs in scala 3 macro (#167)
This would allow to extend `ScalafixModule` in Mill with scala 3, without having to override `fix` command off this problem goes away if they republish, but it could be nice to have anyway - as other mixed 2.13 classpaths could be needed by a user
- Loading branch information
1 parent
44e4351
commit 7ed0ce1
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package mainargs | ||
import utest._ | ||
|
||
object VarargsScala2CompatTests extends VarargsBaseTests { | ||
object Base { | ||
|
||
// (foo: scala.`<repeated>`[T]) === (foo: T*) in Scala 2 pickles (which can be read from Scala 3) | ||
// in Scala 3, the equivalent is (foo: Seq[T] @repeated) | ||
@main | ||
def pureVariadic(nums: scala.`<repeated>`[Int]) = nums.sum | ||
|
||
@main | ||
def mixedVariadic(@arg(short = 'f') first: Int, args: scala.`<repeated>`[String]) = | ||
first.toString + args.mkString | ||
} | ||
|
||
val check = new Checker(ParserForMethods(Base), allowPositional = true) | ||
val isNewVarargsTests = false | ||
} |