diff options
author | Martin Odersky <odersky@gmail.com> | 2003-04-02 07:32:39 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-04-02 07:32:39 +0000 |
commit | f115eda9c9bc97313591ca699e07fa2a117cc997 (patch) | |
tree | e9040aad58088217db6b3a4c950bd6c257c89cb5 /test/pos | |
parent | d8284d61f2f09a72f223c6e9396eec8fa5893d29 (diff) | |
download | scala-f115eda9c9bc97313591ca699e07fa2a117cc997.tar.gz scala-f115eda9c9bc97313591ca699e07fa2a117cc997.tar.bz2 scala-f115eda9c9bc97313591ca699e07fa2a117cc997.zip |
*** empty log message ***
Diffstat (limited to 'test/pos')
-rw-r--r-- | test/pos/infer.scala | 11 | ||||
-rw-r--r-- | test/pos/patterns.scala | 18 |
2 files changed, 27 insertions, 2 deletions
diff --git a/test/pos/infer.scala b/test/pos/infer.scala new file mode 100644 index 0000000000..7e88585ae7 --- /dev/null +++ b/test/pos/infer.scala @@ -0,0 +1,11 @@ +module test { + class List[a] { + def ::(x: a): List[a] = new Cons(x, this); + } + case class Cons[a](x: a, xs: List[a]) extends List[a]; + case class Nil[a] extends List[a]; + def nil[a]: Nil[a] = new Nil[a]; + def cons[a](x: a, xs: List[a]): List[a] = null; + val x: List[Int] = Nil.::(1); + val y: List[Int] = nil.::(1); +}
\ No newline at end of file diff --git a/test/pos/patterns.scala b/test/pos/patterns.scala index 48c068c618..5680b093ef 100644 --- a/test/pos/patterns.scala +++ b/test/pos/patterns.scala @@ -1,6 +1,20 @@ trait Option[a] {} -case class Some[a](x: a) extends Option[a]; -case class None[a] extends Option[a]; +case class Some[a](x: a) extends Option[a] { + override def toString(): scala.String = "Some(" + x + ")"; + override def == (that: Any): Boolean = that match { + case Some(x) => this.x == x + case _ => false + } + override def hashCode(): scala.Int = getClass().hashCode() * 41 + x.hashCode(); +} +case class None[a] extends Option[a] { + override def toString(): scala.String = "None"; + override def == (that: Any) = that match { + case None => true + case _ => false + } + override def hashCode(): scala.Int = getClass().hashCode(); +} object test { |