Permalink
Browse files

Fix for SI-6662, macro failing too early.

Don't give up before you try tupling. Who knows what
someone might be doing with a Unit.
  • Loading branch information...
paulp authored and xeno-by committed Nov 13, 2012
1 parent 1a6c859 commit b9225732889448378ccb880faa6d8421cf40e02c
@@ -3078,7 +3078,7 @@ trait Typers extends Modes with Adaptations with Tags {
def checkNotMacro() = {
if (fun.symbol != null && fun.symbol.filter(sym => sym != null && sym.isTermMacro && !sym.isErroneous) != NoSymbol)
- duplErrorTree(NamedAndDefaultArgumentsNotSupportedForMacros(tree, fun))
+ tryTupleApply getOrElse duplErrorTree(NamedAndDefaultArgumentsNotSupportedForMacros(tree, fun))
}
if (mt.isErroneous) duplErrTree
@@ -0,0 +1 @@
+()
@@ -0,0 +1,8 @@
+import language.experimental.macros
+import scala.reflect.macros.Context
+
+object Demo {
+ def id[T](a: T): T = macro idImpl[T]
+
+ def idImpl[T: c.WeakTypeTag](c: Context)(a: c.Expr[T]): c.Expr[T] = a
+}
@@ -0,0 +1,8 @@
+// Macro usage:
+
+object Test {
+ def main(args: Array[String]) {
+ val s = Demo id ()
+ println(s)
+ }
+}

0 comments on commit b922573

Please sign in to comment.