diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-06-05 20:36:51 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-06-08 15:23:10 +0200 |
commit | c7491eb1c7d41c5eaecb20f9e2f82fd208a6713e (patch) | |
tree | 49093c1d1c8ba0857e845bdfc0aa5b3710d76787 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala | |
parent | c74533ad6547befcfaf524dcb93c920f922c47e1 (diff) | |
download | scala-c7491eb1c7d41c5eaecb20f9e2f82fd208a6713e.tar.gz scala-c7491eb1c7d41c5eaecb20f9e2f82fd208a6713e.tar.bz2 scala-c7491eb1c7d41c5eaecb20f9e2f82fd208a6713e.zip |
improves traces and error messages
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 217cadaab8..6a2a9b850c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1183,16 +1183,24 @@ trait Implicits { // if ``pre'' is not a PDT, e.g. if someone wrote // implicitly[scala.reflect.makro.Context#TypeTag[Int]] // then we need to fail, because we don't know the prefix to use during type reification - return failure(tp, "tag error: unsupported prefix type %s (%s)".format(pre, pre.kind)) + // upd. we also need to fail silently, because this is a very common situation + // e.g. quite often we're searching for BaseUniverse#TypeTag, e.g. for a type tag in any universe + // so that if we find one, we could convert it to whatever universe we need by the means of the `in` method + // if no tag is found in scope, we end up here, where we ask someone to materialize the tag for us + // however, since the original search was about a tag with no particular prefix, we cannot proceed + // this situation happens very often, so emitting an error message here (even if only for -Xlog-implicits) would be too much + //return failure(tp, "tag error: unsupported prefix type %s (%s)".format(pre, pre.kind)) + return SearchFailure } ) // todo. migrate hardcoded materialization in Implicits to corresponding implicit macros - var materializer = atPos(pos.focus)( - gen.mkMethodCall(TagMaterializers(tagClass), List(tp), List(prefix)) - ) + var materializer = atPos(pos.focus)(gen.mkMethodCall(TagMaterializers(tagClass), List(tp), List(prefix))) if (settings.XlogImplicits.value) println("materializing requested %s.%s[%s] using %s".format(pre, tagClass.name, tp, materializer)) if (context.macrosEnabled) success(materializer) - else failure(materializer, "macros are disabled") + // don't call `failure` here. if macros are disabled, we just fail silently + // otherwise -Xlog-implicits will spam the long with zillions of "macros are disabled" + // this is ugly but temporary, since all this code will be removed once I fix implicit macros + else SearchFailure } private val ManifestSymbols = Set[Symbol](PartialManifestClass, FullManifestClass, OptManifestClass) |