diff options
author | Geoff Reedy <geoff@programmer-monk.net> | 2012-03-20 19:33:52 -0600 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-06 11:57:32 -0700 |
commit | 41c0b0b7b9bd5089e35e1bf32fbcb471a9c78641 (patch) | |
tree | ada73e95ede021ed16fa92c07cc5d976cbdfd188 | |
parent | 19bb1732646c77e58fd63490afdca066afd5ec15 (diff) | |
download | scala-41c0b0b7b9bd5089e35e1bf32fbcb471a9c78641.tar.gz scala-41c0b0b7b9bd5089e35e1bf32fbcb471a9c78641.tar.bz2 scala-41c0b0b7b9bd5089e35e1bf32fbcb471a9c78641.zip |
Fix for SI-5591.
And test case for SI-5591.
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala | 2 | ||||
-rw-r--r-- | test/files/run/phantomValueClass.check | 1 | ||||
-rw-r--r-- | test/files/run/phantomValueClass.scala | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala index 5104518dd9..3515c1d521 100644 --- a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala +++ b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala @@ -68,7 +68,7 @@ abstract class ExtensionMethods extends Transform with TypingTransformers { private def normalize(stpe: Type, clazz: Symbol): Type = stpe match { case PolyType(tparams, restpe) => - GenPolyType(tparams dropRight clazz.typeParams.length, normalize(restpe, clazz)) + GenPolyType(tparams dropRight clazz.typeParams.length, normalize(restpe.substSym(tparams takeRight clazz.typeParams.length, clazz.typeParams), clazz)) case MethodType(tparams, restpe) => restpe case _ => diff --git a/test/files/run/phantomValueClass.check b/test/files/run/phantomValueClass.check new file mode 100644 index 0000000000..323fae03f4 --- /dev/null +++ b/test/files/run/phantomValueClass.check @@ -0,0 +1 @@ +foobar diff --git a/test/files/run/phantomValueClass.scala b/test/files/run/phantomValueClass.scala new file mode 100644 index 0000000000..f6509f2189 --- /dev/null +++ b/test/files/run/phantomValueClass.scala @@ -0,0 +1,10 @@ +final class Phantom[A](val s: String) extends AnyVal { + def compose(p: Phantom[A]): Phantom[A] = new Phantom[A](s+p.s) +} + +object Test extends App { + val x = new Phantom[Int]("foo") + val y = new Phantom[Int]("bar") + val z = x compose y + println(z.s) +} |