diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-20 10:59:00 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-20 13:56:18 +0200 |
commit | 990700039a5972a697471b460c021c5a2d6dbd65 (patch) | |
tree | 10207b1f70ee33f63f99bf25f698018115f09520 /test/files/run/typetags_without_scala_reflect_manifest_lookup.scala | |
parent | 3b120ff12891968d02296abb60adb9137d335ae2 (diff) | |
download | scala-990700039a5972a697471b460c021c5a2d6dbd65.tar.gz scala-990700039a5972a697471b460c021c5a2d6dbd65.tar.bz2 scala-990700039a5972a697471b460c021c5a2d6dbd65.zip |
don't try to create tags w/o scala-reflect.jar
Since recently type tags have relocated to scala-reflect.jar,
meaning that they are no longer always on library classpath.
In the compiler we do have code that generates type tags, and this code
is bound to fail if scala-reflect.jar isn't there.
I though this wouldn't be a problem, because type tag materialization
is only going to be triggered by users explicitly requesting a type tag.
That's generally true, but I overlooked a corner case. Since we provide
manifest <-> type tag compatibility, manifest lookup can sometimes trigger
tag lookup, which might result in tag synthesis, which blows up like this:
http://groups.google.com/group/scala-internals/browse_thread/thread/166ce4b71b7c46bb
This commit also ensures that type tag generation/interop doesnt sneak into the
code of the libraries that don't have scala-reflect.jar on their classpath.
For details refer to the discussion at scala-internals:
http://groups.google.com/group/scala-internals/browse_thread/thread/72f6ce3010f4d8
Diffstat (limited to 'test/files/run/typetags_without_scala_reflect_manifest_lookup.scala')
-rw-r--r-- | test/files/run/typetags_without_scala_reflect_manifest_lookup.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala b/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala new file mode 100644 index 0000000000..37047e7884 --- /dev/null +++ b/test/files/run/typetags_without_scala_reflect_manifest_lookup.scala @@ -0,0 +1,29 @@ +import scala.tools.partest._ +import scala.tools.nsc.Settings + +object Test extends DirectTest { + override def extraSettings = "-cp " + sys.props("partest.lib") + + def code = """ + object Test extends App { + // manifest lookup also involves type tag lookup + // because we support manifest <-> typetag convertability + // + // however when scala-reflect.jar (the home of type tags) is not on the classpath + // we need to omit the type tag lookup, because we lack the necessary symbols + // to do implicit search and tag materialization + // (such missing symbols are e.g. ApiUniverseClass and TypeTagsClass) + // + // the test case you're looking at checks exactly this + // we establish a classpath that only includes scala-library.jar + // and then force scalac to perform implicit search for a manifest + // if type tag lookup is not disabled, the compiler will crash + // if it is disabled, then the compilation will succeed + // http://groups.google.com/group/scala-internals/browse_thread/thread/166ce4b71b7c46bb + def foo[T: Manifest] = () + foo[List[Int]] + } + """ + + def show = compile() +}
\ No newline at end of file |