diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-15 12:15:38 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-15 12:20:59 -0800 |
commit | 32646c3b84ecb4ae7946c3ea6f74eaade38bc4e0 (patch) | |
tree | 2322e048aa49a3f96c2b1900a6d9f1d550bbdb8f /test | |
parent | 6543b2d983a4e44ad9bd2ea036d53ce52c37284c (diff) | |
download | scala-32646c3b84ecb4ae7946c3ea6f74eaade38bc4e0.tar.gz scala-32646c3b84ecb4ae7946c3ea6f74eaade38bc4e0.tar.bz2 scala-32646c3b84ecb4ae7946c3ea6f74eaade38bc4e0.zip |
Test cases which motivated preceding reversions.
See t5452 for disabled/neg/t5452 and disabled/pos/spurious-overload
I give up, review by @hubertp.
Diffstat (limited to 'test')
-rw-r--r-- | test/disabled/neg/t5452.check | 8 | ||||
-rw-r--r-- | test/disabled/neg/t5452.scala | 29 | ||||
-rw-r--r-- | test/disabled/pos/spurious-overload.scala | 32 |
3 files changed, 69 insertions, 0 deletions
diff --git a/test/disabled/neg/t5452.check b/test/disabled/neg/t5452.check new file mode 100644 index 0000000000..2f35a45509 --- /dev/null +++ b/test/disabled/neg/t5452.check @@ -0,0 +1,8 @@ +t5452.scala:28: error: overloaded method value apply with alternatives: + ()Queryable[CoffeesTable] <and> + (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and> + (implicit evidence$1: Manifest[CoffeesTable])Nothing + cannot be applied to (Queryable[CoffeesTable]) + Queryable[CoffeesTable]( q.treeFilter(null) ) + ^ +one error found diff --git a/test/disabled/neg/t5452.scala b/test/disabled/neg/t5452.scala new file mode 100644 index 0000000000..1032db7a4b --- /dev/null +++ b/test/disabled/neg/t5452.scala @@ -0,0 +1,29 @@ +// /scala/trac/5452/a.scala +// Mon Feb 13 22:52:36 PST 2012 + +// import scala.reflect.mirror._ + +trait Tree + +object Bip { + def ??? = sys.error("") +} +import Bip._ + +case class Queryable[T]() { + def treeFilter( t:Tree ) : Queryable[T] = ??? +} + +object Queryable { + def apply[T:Manifest] = ??? + def apply[T:Manifest]( t:Tree ) = ??? +} + +trait CoffeesTable{ + def sales : Int +} + +object Test extends App{ + val q = new Queryable[CoffeesTable] + Queryable[CoffeesTable]( q.treeFilter(null) ) +} diff --git a/test/disabled/pos/spurious-overload.scala b/test/disabled/pos/spurious-overload.scala new file mode 100644 index 0000000000..9767a44eee --- /dev/null +++ b/test/disabled/pos/spurious-overload.scala @@ -0,0 +1,32 @@ +object Test extends App { + def foo(bar: Any) = bar + + val code = foo{ + object lazyLib { + + def delay[A](value: => A): Susp[A] = new SuspImpl[A](value) + + implicit def force[A](s: Susp[A]): A = s() + + abstract class Susp[+A] extends Function0[A] + + class SuspImpl[A](lazyValue: => A) extends Susp[A] { + private var maybeValue: Option[A] = None + + override def apply() = maybeValue match { + case None => + val value = lazyValue + maybeValue = Some(value) + value + case Some(value) => + value + } + } + } + + import lazyLib._ + + val s: Susp[Int] = delay { println("evaluating..."); 3 } + println("2 + s = " + (2 + s)) // implicit call to force() + } +}
\ No newline at end of file |