summaryrefslogtreecommitdiff
path: root/test/files/run/t5923d
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-04-30 21:14:06 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-08-13 05:36:33 +0200
commit21a8c6c7558a67b642b6827f716b1aba2244c97f (patch)
treeb54f9da9a1a1e263ce0e614a1282dc96b15b77ac /test/files/run/t5923d
parent4c62f7db6f3913eedd92d85daf8f631149cc97b2 (diff)
downloadscala-21a8c6c7558a67b642b6827f716b1aba2244c97f.tar.gz
scala-21a8c6c7558a67b642b6827f716b1aba2244c97f.tar.bz2
scala-21a8c6c7558a67b642b6827f716b1aba2244c97f.zip
SI-7470 implements fundep materialization
This fix provides implicit macros with an ability to affect type inference in a more or less sane manner. That's crucial for materialization of multi-parametric type class instances (e.g. Iso's from shapeless). Details of the technique can be found in comments.
Diffstat (limited to 'test/files/run/t5923d')
-rw-r--r--test/files/run/t5923d/Macros_1.scala9
-rw-r--r--test/files/run/t5923d/Test_2.scala7
2 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/t5923d/Macros_1.scala b/test/files/run/t5923d/Macros_1.scala
new file mode 100644
index 0000000000..f32d1af704
--- /dev/null
+++ b/test/files/run/t5923d/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+trait MappedRow
+trait RowMapper[T <: MappedRow]
+object RowMapper {
+ implicit def mapper[T <: MappedRow]: RowMapper[T] = macro impl[T]
+ def impl[T <: MappedRow : c.WeakTypeTag](c: Context) = c.universe.reify(new RowMapper[T]{})
+} \ No newline at end of file
diff --git a/test/files/run/t5923d/Test_2.scala b/test/files/run/t5923d/Test_2.scala
new file mode 100644
index 0000000000..6be10227c2
--- /dev/null
+++ b/test/files/run/t5923d/Test_2.scala
@@ -0,0 +1,7 @@
+class RowA extends MappedRow
+class RowB extends MappedRow
+
+object Test extends App {
+ implicitly[RowMapper[RowA]]
+ implicitly[RowMapper[RowB]]
+} \ No newline at end of file