diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-13 22:24:09 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-11-14 11:46:08 +0100 |
commit | df2ebee249f94bbba273ce70a9a3331d07131230 (patch) | |
tree | 19c6e6cee5a84a22c42df6e981f94d131b2e5664 /src/test | |
parent | 9500b044e05c3f676f29f1395f2036f145f84765 (diff) | |
download | scala-async-df2ebee249f94bbba273ce70a9a3331d07131230.tar.gz scala-async-df2ebee249f94bbba273ce70a9a3331d07131230.tar.bz2 scala-async-df2ebee249f94bbba273ce70a9a3331d07131230.zip |
Fix crasher in icode due to symbol mismatches in lifted methods
These stem from the handling of the internal/external view
or method type parameters by `thisMethodType` in `Namers`.
I've now preseversed the orginal ValDefs favoured the latter
when constructing the new DefDef, and made construction of
all liftables consistent in this regard.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/scala/scala/async/run/toughtype/ToughType.scala | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/scala/scala/async/run/toughtype/ToughType.scala b/src/test/scala/scala/async/run/toughtype/ToughType.scala index b342a00..1551856 100644 --- a/src/test/scala/scala/async/run/toughtype/ToughType.scala +++ b/src/test/scala/scala/async/run/toughtype/ToughType.scala @@ -135,9 +135,59 @@ class ToughTypeSpec { } foo } + + // This test was failing when lifting `def r` with: + // symbol value m#10864 does not exist in r$1 + // + // We generated: + // + // private[this] def r$1#5727[A#5728 >: Nothing#157 <: Any#156](m#5731: Foo#2349[A#5728]): Unit#208 = Bippy#2352.this.bar#5532({ + // m#5730; + // () + // }); + // + // Notice the incorrect reference to `m`. + // + // We compensated in `Lifter` by copying `ValDef` parameter symbols directly across. + // + // Turns out the behaviour stems from `thisMethodType` in `Namers`, which treats type parameter skolem symbols. + @Test def nestedMethodWithInconsistencyTreeAndInfoParamSymbols() { + import language.{reflectiveCalls, postfixOps} + import scala.concurrent.{Future, ExecutionContext, future, Await} + import scala.concurrent.duration._ + import scala.async.Async.{async, await} + import scala.async.internal.AsyncId + + class Foo[A] + + object Bippy { + + import ExecutionContext.Implicits.global + + def bar(f: => Unit): Unit = f + + def quux: Future[String] = ??? + + def foo = async { + def r[A](m: Foo[A])(n: A) = { + bar { + locally(m) + locally(n) + identity[A] _ + } + } + + await(quux) + + r(new Foo[String])("") + } + } + Bippy + } } trait A + trait B trait L[A2, B2 <: A2] { |