Skip to content

Commit 0221817

Browse files
authored
Fix hygiene of macros #12
Fixes com-lihaoyi/Ammonite#953 Review by @lolgab @jodersky
1 parent 6eaf355 commit 0221817

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

mainargs/src/Macros.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Macros(val c: Context) {
146146
_root_.mainargs.MainData.create[$returnType, $curCls](
147147
$methodName,
148148
$mainInstance,
149-
Seq(..$argSigs),
149+
_root_.scala.Seq(..$argSigs),
150150
($baseArgSym: $curCls, $argListSymbol: _root_.scala.Seq[_root_.scala.Any]) => {
151151
$baseArgSym.${TermName(methodName)}(..$argNameCasts)
152152
}

mainargs/test/src/HygieneTests.scala

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package mainargs
2+
import utest._
3+
4+
5+
object HygieneTests extends TestSuite{
6+
7+
object Main{
8+
@main
9+
def run(@arg(short = 'f', doc = "String to print repeatedly")
10+
foo: String,
11+
@arg(name = "my-num", doc = "How many times to print string")
12+
myNum: Int = 2,
13+
@arg(doc = "Example flag")
14+
bool: Flag) = {
15+
foo * myNum + " " + bool.value
16+
}
17+
}
18+
19+
val tests = Tests {
20+
import scala.collection.mutable._
21+
test("importingSeqShouldntFailCompile"){
22+
ParserForMethods(Main)
23+
}
24+
25+
}
26+
}

0 commit comments

Comments
 (0)