diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t0899.check | 10 | ||||
-rw-r--r-- | test/files/neg/t0899.scala | 13 | ||||
-rw-r--r-- | test/files/run/t0700.check | 2 | ||||
-rwxr-xr-x | test/files/run/t0700.scala | 24 | ||||
-rw-r--r-- | test/files/run/t0911.scala | 2 |
5 files changed, 50 insertions, 1 deletions
diff --git a/test/files/neg/t0899.check b/test/files/neg/t0899.check new file mode 100644 index 0000000000..8b71be8e0c --- /dev/null +++ b/test/files/neg/t0899.check @@ -0,0 +1,10 @@ +t0899.scala:9: error: super may be not be used on value o + override val o = "Ha! " + super.o + ^ +t0899.scala:11: error: super may be not be used on variable v + super.v = "aa" + ^ +t0899.scala:12: error: super may be not be used on variable v + println(super.v) + ^ +three errors found diff --git a/test/files/neg/t0899.scala b/test/files/neg/t0899.scala new file mode 100644 index 0000000000..817dc19eb4 --- /dev/null +++ b/test/files/neg/t0899.scala @@ -0,0 +1,13 @@ +class Top { + val o = "Hi there!" + var v = "Hi there!" + type T + val x: T +} + +class Bot extends Top { + override val o = "Ha! " + super.o + val y: super.T = x + super.v = "aa" + println(super.v) +} diff --git a/test/files/run/t0700.check b/test/files/run/t0700.check new file mode 100644 index 0000000000..b4eabbab1a --- /dev/null +++ b/test/files/run/t0700.check @@ -0,0 +1,2 @@ +[3.2] parsed: List(2, 2, 2) +[3.2] parsed: List(2, 2, 2) diff --git a/test/files/run/t0700.scala b/test/files/run/t0700.scala new file mode 100755 index 0000000000..5a7180528c --- /dev/null +++ b/test/files/run/t0700.scala @@ -0,0 +1,24 @@ +import java.io.{File,StringReader} + +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.{CharArrayReader, StreamReader} + +class TestParsers extends Parsers { + type Elem = Char + + def p: Parser[List[Int]] = rep(p1 | p2) + def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1 + def p2: Parser[Int] = 'a' ~ nl ^^^ 2 + def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0 +} + +object Test { + def main(args: Array[String]): Unit = { + val tstParsers = new TestParsers + val s = "a\na\na" + val r1 = new CharArrayReader(s.toCharArray()) + val r2 = StreamReader(new StringReader(s)) + println(tstParsers.p(r1)) + println(tstParsers.p(r2)) + } +} diff --git a/test/files/run/t0911.scala b/test/files/run/t0911.scala index f4d93eb571..6f9ad91781 100644 --- a/test/files/run/t0911.scala +++ b/test/files/run/t0911.scala @@ -4,6 +4,6 @@ class IP extends { val baz = "bar"; } with Foo(() => baz); -object Main extends Application{ +object Test extends Application{ (new IP).bar(); } |