diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-11-14 02:04:19 -0800 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-11-14 02:04:19 -0800 |
commit | ace401c8084f94a5ca5c38f3a10c5eee18b65645 (patch) | |
tree | 6afb0ca9a4cc1dbdd51ccec6e434de480ac38b1b | |
parent | 4c0b9b264246a1ba63196deb3558027413eb3490 (diff) | |
parent | b9225732889448378ccb880faa6d8421cf40e02c (diff) | |
download | scala-ace401c8084f94a5ca5c38f3a10c5eee18b65645.tar.gz scala-ace401c8084f94a5ca5c38f3a10c5eee18b65645.tar.bz2 scala-ace401c8084f94a5ca5c38f3a10c5eee18b65645.zip |
Merge pull request #1618 from scalamacros/ticket/6662
Fix for SI-6662, macro failing too early.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | test/files/run/t6662.check | 1 | ||||
-rw-r--r-- | test/files/run/t6662/Macro_1.scala | 8 | ||||
-rw-r--r-- | test/files/run/t6662/Test_2.scala | 8 |
4 files changed, 18 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index df3731794a..d3847de894 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -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 diff --git a/test/files/run/t6662.check b/test/files/run/t6662.check new file mode 100644 index 0000000000..6a452c185a --- /dev/null +++ b/test/files/run/t6662.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t6662/Macro_1.scala b/test/files/run/t6662/Macro_1.scala new file mode 100644 index 0000000000..f373eaaf94 --- /dev/null +++ b/test/files/run/t6662/Macro_1.scala @@ -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 +} diff --git a/test/files/run/t6662/Test_2.scala b/test/files/run/t6662/Test_2.scala new file mode 100644 index 0000000000..03a80b655a --- /dev/null +++ b/test/files/run/t6662/Test_2.scala @@ -0,0 +1,8 @@ +// Macro usage: + +object Test { + def main(args: Array[String]) { + val s = Demo id () + println(s) + } +} |