diff options
author | Martin Odersky <odersky@gmail.com> | 2008-07-10 16:54:35 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-07-10 16:54:35 +0000 |
commit | 9dc05dc520c149d97877526d651d40d9c31214e3 (patch) | |
tree | d76aa3e9b76df3006e6460314b2707392e1c27e4 /test | |
parent | 79727b4ea3c4e672d2f9ce64a167de47e8006d15 (diff) | |
download | scala-9dc05dc520c149d97877526d651d40d9c31214e3.tar.gz scala-9dc05dc520c149d97877526d651d40d9c31214e3.tar.bz2 scala-9dc05dc520c149d97877526d651d40d9c31214e3.zip |
fixed #764 and #770
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t0764.check | 6 | ||||
-rw-r--r-- | test/files/neg/t0764.scala | 14 | ||||
-rw-r--r-- | test/files/pos/t0770.scala | 13 | ||||
-rwxr-xr-x | test/files/pos/t1059.scala | 28 |
4 files changed, 61 insertions, 0 deletions
diff --git a/test/files/neg/t0764.check b/test/files/neg/t0764.check new file mode 100644 index 0000000000..b622f17c5e --- /dev/null +++ b/test/files/neg/t0764.check @@ -0,0 +1,6 @@ +t0764.scala:13: error: type mismatch; + found : java.lang.Object with Node{type T = _1.type} where val _1: Main.this.AType + required: Node{type T = Main.this.AType} + new Main[AType]( (value: AType).prepend ) + ^ +one error found diff --git a/test/files/neg/t0764.scala b/test/files/neg/t0764.scala new file mode 100644 index 0000000000..daeeb21d91 --- /dev/null +++ b/test/files/neg/t0764.scala @@ -0,0 +1,14 @@ +class Top[A] { + type AType = A +} + +trait Node extends NotNull { outer => + type T <: Node + def prepend = new Node { type T = outer.type } +} + +class Main[NextType <: Node](value: Node { type T = NextType }) + extends Top[Node { type T = NextType }] { + + new Main[AType]( (value: AType).prepend ) +} diff --git a/test/files/pos/t0770.scala b/test/files/pos/t0770.scala new file mode 100644 index 0000000000..7a0a2bf9bb --- /dev/null +++ b/test/files/pos/t0770.scala @@ -0,0 +1,13 @@ +trait A +{ + private[this] val p = 5 + + def f = (b: Byte) => p +} + +trait B +{ + def failure: Boolean + def success = !failure +} + diff --git a/test/files/pos/t1059.scala b/test/files/pos/t1059.scala new file mode 100755 index 0000000000..659bf375ca --- /dev/null +++ b/test/files/pos/t1059.scala @@ -0,0 +1,28 @@ +package com; + +import scala.xml._ + +object Main { + + def main(args : Array[String]) : Unit = { + + var m : PartialFunction[Any, Any] = { + + case SafeNodeSeq(s @ _*) => println(s) } + + println(m(<a/> ++ <b/>)) + println(m.isDefinedAt(<a/> ++ <b/>)) + + } + +} + +object SafeNodeSeq { + + def unapplySeq(any: Any) : Option[Seq[Node]] = any match { case s: Seq[_] => Some(s flatMap ( _ match { + + case n: Node => n case _ => NodeSeq.Empty + + })) case _ => None } + +} |