diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-05 11:20:20 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-05 11:20:20 -0800 |
commit | 18481cef9b219c48b3497c4605b793b22a7faf79 (patch) | |
tree | c26d54bdd778099800a7d795d054d00a92a4552f | |
parent | e15d8fca905a193db3c963591129166710147319 (diff) | |
parent | eccdc2fefcf0839e09bb9c63c89baed8cf09e60f (diff) | |
download | scala-18481cef9b219c48b3497c4605b793b22a7faf79.tar.gz scala-18481cef9b219c48b3497c4605b793b22a7faf79.tar.bz2 scala-18481cef9b219c48b3497c4605b793b22a7faf79.zip |
Merge pull request #1704 from retronym/ticket/6754-2v2.10.0-RC5v2.10.0
Fix for rangepos crasher.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 | ||||
-rw-r--r-- | test/files/pos/classtag-pos.flags | 1 | ||||
-rw-r--r-- | test/files/pos/classtag-pos.scala | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 934ba91ac8..b823e1ad0f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3362,12 +3362,13 @@ trait Typers extends Modes with Adaptations with Tags { // println(util.Position.formatMessage(uncheckedPattern.pos, "made unchecked type test into a checked one", true)) val args = List(uncheckedPattern) + val app = atPos(uncheckedPattern.pos)(Apply(classTagExtractor, args)) // must call doTypedUnapply directly, as otherwise we get undesirable rewrites // and re-typechecks of the target of the unapply call in PATTERNmode, // this breaks down when the classTagExtractor (which defineds the unapply member) is not a simple reference to an object, // but an arbitrary tree as is the case here - doTypedUnapply(Apply(classTagExtractor, args), classTagExtractor, classTagExtractor, args, PATTERNmode, pt) - } + doTypedUnapply(app, classTagExtractor, classTagExtractor, args, PATTERNmode, pt) + } // if there's a ClassTag that allows us to turn the unchecked type test for `pt` into a checked type test // return the corresponding extractor (an instance of ClassTag[`pt`]) diff --git a/test/files/pos/classtag-pos.flags b/test/files/pos/classtag-pos.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/classtag-pos.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/classtag-pos.scala b/test/files/pos/classtag-pos.scala new file mode 100644 index 0000000000..768d2e27f4 --- /dev/null +++ b/test/files/pos/classtag-pos.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +class A { + def f[T: TypeTag] = typeOf[T] match { case TypeRef(_, _, args) => args } +} |