diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-16 22:30:24 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-16 22:34:16 -0700 |
commit | 0c3ca2248d55eeeee2db6693e5fc46b9ba049eda (patch) | |
tree | 71686d0b99fc1d4a245ddb24efe50398b0c00c78 /test/files/run/macro-divergence-spurious | |
parent | c663ecf8677eda3fe8c91170b614eb7166b18711 (diff) | |
parent | 13b4628aabb8e7a293a382dcab6db5848f672f94 (diff) | |
download | scala-0c3ca2248d55eeeee2db6693e5fc46b9ba049eda.tar.gz scala-0c3ca2248d55eeeee2db6693e5fc46b9ba049eda.tar.bz2 scala-0c3ca2248d55eeeee2db6693e5fc46b9ba049eda.zip |
Merge branch 'master' into HEAD
* master:
SI-7469 Remove @deprecated scala.util.logging
SI-3943 Test case for already-fixed Java interop bug
Fix formatting for couple of docs in the compiler
SI-7476 Add documentation to GenericTraversableTemplate
SI-7469 Remove @deprecated scala.util.parsing.ast
SI-7469 Remove @deprecated MurmurHash elements
SI-7469 Remove deprecated elements in s.u.parsing.combinator
SI-7469 Make @deprecated elems in scala.concurrent private[scala]
removes duplication in inferImplicitValue
SI-7047 fixes silent for c.inferImplicitXXX
SI-7167 implicit macros decide what is divergence
macroExpandAll is now triggered in all invocations of typed
SI-5923 instantiates targs in deferred macro applications
SI-6406 Restore deprecated API
SI-6039 Harden against irrelevant filesystem details
Limit unnecessary calls to Type#toString.
fix typo in comment
SI-7432 add testcases
SI-7432 Range.min should throw NoSuchElementException on empty range
AbstractFile.getDirectory does not return null when outDir is "."
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
Diffstat (limited to 'test/files/run/macro-divergence-spurious')
-rw-r--r-- | test/files/run/macro-divergence-spurious/Impls_Macros_1.scala | 23 | ||||
-rw-r--r-- | test/files/run/macro-divergence-spurious/Test_2.scala | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala new file mode 100644 index 0000000000..bc4a9fded7 --- /dev/null +++ b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala @@ -0,0 +1,23 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +trait Complex[T] + +class Foo(val bar: Bar) +class Bar(val s: String) + +object Complex { + def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = { + import c.universe._ + val tpe = weakTypeOf[T] + for (f <- tpe.declarations.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) { + val trecur = appliedType(typeOf[Complex[_]], List(f.typeSignature)) + val recur = c.inferImplicitValue(trecur, silent = true) + if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur") + } + c.literalNull + } + + implicit object ComplexString extends Complex[String] + implicit def genComplex[T]: Complex[T] = macro impl[T] +} diff --git a/test/files/run/macro-divergence-spurious/Test_2.scala b/test/files/run/macro-divergence-spurious/Test_2.scala new file mode 100644 index 0000000000..dcc4593335 --- /dev/null +++ b/test/files/run/macro-divergence-spurious/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(implicitly[Complex[Foo]]) +}
\ No newline at end of file |