diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-12-18 16:55:15 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-08 20:50:08 +0100 |
commit | d744921f855a6c5d4f4df62895bc3b17b8e0e532 (patch) | |
tree | 5ab2f9bf09b1f6091bb71c05c99a2cc077f28570 /test | |
parent | d6b4cda628d43c2c7ede1fbfbffbff7cd62d2919 (diff) | |
download | scala-d744921f855a6c5d4f4df62895bc3b17b8e0e532.tar.gz scala-d744921f855a6c5d4f4df62895bc3b17b8e0e532.tar.bz2 scala-d744921f855a6c5d4f4df62895bc3b17b8e0e532.zip |
SI-8064 Automatic position repair for macro expansion
- Replace NoPosition with the focus of the macro application
- Focus all range positions, for example, those of spliced arguments
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t8064.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8064/Client_2.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t8064/Macro_1.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t8064b.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8064b/Client_2.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t8064b/Macro_1.scala | 11 |
6 files changed, 37 insertions, 0 deletions
diff --git a/test/files/pos/t8064.flags b/test/files/pos/t8064.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/t8064.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/t8064/Client_2.scala b/test/files/pos/t8064/Client_2.scala new file mode 100644 index 0000000000..44106782c7 --- /dev/null +++ b/test/files/pos/t8064/Client_2.scala @@ -0,0 +1,8 @@ +object Test { + Macro { + def s = "" + Macro(s): @unchecked + ??? + } +} +// Was: a range position validation error (unpositioned tree)
\ No newline at end of file diff --git a/test/files/pos/t8064/Macro_1.scala b/test/files/pos/t8064/Macro_1.scala new file mode 100644 index 0000000000..4fabd54a89 --- /dev/null +++ b/test/files/pos/t8064/Macro_1.scala @@ -0,0 +1,10 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macro { + def apply(a: Any): Any = macro impl + + def impl(c: Context)(a: c.Tree): c.Tree = { + c.resetLocalAttrs(a) + } +} diff --git a/test/files/pos/t8064b.flags b/test/files/pos/t8064b.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/t8064b.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/t8064b/Client_2.scala b/test/files/pos/t8064b/Client_2.scala new file mode 100644 index 0000000000..a7bf2b9fb4 --- /dev/null +++ b/test/files/pos/t8064b/Client_2.scala @@ -0,0 +1,6 @@ +object Test { + Macro { + "".reverse + } +} +// Was: a range position validation error (tree with offset position enclosing tree with range position)
\ No newline at end of file diff --git a/test/files/pos/t8064b/Macro_1.scala b/test/files/pos/t8064b/Macro_1.scala new file mode 100644 index 0000000000..82582356c0 --- /dev/null +++ b/test/files/pos/t8064b/Macro_1.scala @@ -0,0 +1,11 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macro { + def apply(a: Any): Any = macro impl + def impl(c: Context)(a: c.Tree): c.Tree = { + import c.universe._ + + q"{$a; true}" + } +} |