Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hygiene of macros #12

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mainargs/src/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Macros(val c: Context) {
_root_.mainargs.MainData.create[$returnType, $curCls](
$methodName,
$mainInstance,
Seq(..$argSigs),
_root_.scala.Seq(..$argSigs),
($baseArgSym: $curCls, $argListSymbol: _root_.scala.Seq[_root_.scala.Any]) => {
$baseArgSym.${TermName(methodName)}(..$argNameCasts)
}
Expand Down
26 changes: 26 additions & 0 deletions mainargs/test/src/HygieneTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package mainargs
import utest._


object HygieneTests extends TestSuite{

object Main{
@main
def run(@arg(short = 'f', doc = "String to print repeatedly")
foo: String,
@arg(name = "my-num", doc = "How many times to print string")
myNum: Int = 2,
@arg(doc = "Example flag")
bool: Flag) = {
foo * myNum + " " + bool.value
}
}

val tests = Tests {
import scala.collection.mutable._
test("importingSeqShouldntFailCompile"){
ParserForMethods(Main)
}

}
}