diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-24 20:42:27 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-24 20:42:27 +0200 |
commit | bdf9195993caa3eee4f3be49428566323eaf4afd (patch) | |
tree | a11c4fe9634e3bf919d467267439a6da15225f1a | |
parent | e948b39ca4df48b2acb0e972a2caf674c643a990 (diff) | |
download | scala-bdf9195993caa3eee4f3be49428566323eaf4afd.tar.gz scala-bdf9195993caa3eee4f3be49428566323eaf4afd.tar.bz2 scala-bdf9195993caa3eee4f3be49428566323eaf4afd.zip |
SI-8617 Avoid rangepos crash for OptManifest materializer
The tree to create a `NoManifest` was unpositioned.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t8617.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8617.scala | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index d87090fa46..73c3e6f016 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1306,7 +1306,7 @@ trait Implicits { } def wrapResult(tree: Tree): SearchResult = - if (tree == EmptyTree) SearchFailure else new SearchResult(tree, EmptyTreeTypeSubstituter, Nil) + if (tree == EmptyTree) SearchFailure else new SearchResult(atPos(pos.focus)(tree), EmptyTreeTypeSubstituter, Nil) /** Materializes implicits of predefined types (currently, manifests and tags). * Will be replaced by implicit macros once we fix them. diff --git a/test/files/pos/t8617.flags b/test/files/pos/t8617.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/t8617.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/t8617.scala b/test/files/pos/t8617.scala new file mode 100644 index 0000000000..fc825bbcba --- /dev/null +++ b/test/files/pos/t8617.scala @@ -0,0 +1,10 @@ +object Test { + def foo[A] = implicitly[OptManifest[A]] // was "unpositioned tree" under -Yrangepos + + // These did not crash, but testing for good measure. + implicitly[OptManifest[String]] + implicitly[Manifest[String]] + + implicitly[reflect.ClassTag[String]] + implicitly[reflect.runtime.universe.TypeTag[String]] +} |