- Added tests on blocks
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@3550 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
f531adaf24
commit
f8d775aa0d
|
@ -0,0 +1,16 @@
|
|||
tests.scala:29: package java is not a value
|
||||
{System.out.print(11); java}.lang.System.out.println();
|
||||
^
|
||||
tests.scala:30: package lang is not a value
|
||||
{System.out.print(12); java.lang}.System.out.println();
|
||||
^
|
||||
tests.scala:31: object System is not a value
|
||||
{System.out.print(13); java.lang.System}.out.println();
|
||||
^
|
||||
tests.scala:37: package test0 is not a value
|
||||
{System.out.print(21); test0}.bar.System.out.println();
|
||||
^
|
||||
tests.scala:38: package bar is not a value
|
||||
{System.out.print(22); test0.bar}.System.out.println();
|
||||
^
|
||||
5 errors found
|
|
@ -0,0 +1,47 @@
|
|||
//############################################################################
|
||||
// Compile Time Errors
|
||||
//############################################################################
|
||||
// $Id$
|
||||
|
||||
import java.lang.System; // to avoid name clash with .NET's library
|
||||
|
||||
//############################################################################
|
||||
// Test 0 - Block Qualifiers
|
||||
|
||||
package test0.bar {
|
||||
|
||||
object System {
|
||||
val out: PrintStream = new PrintStream();
|
||||
}
|
||||
|
||||
class PrintStream() {
|
||||
def println(): Unit = {
|
||||
java.lang.System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object Test0Test {
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
{System.out.print(10)}; java.lang.System.out.println();
|
||||
{System.out.print(11); java}.lang.System.out.println();
|
||||
{System.out.print(12); java.lang}.System.out.println();
|
||||
{System.out.print(13); java.lang.System}.out.println();
|
||||
{System.out.print(14); java.lang.System.out}.println();
|
||||
{System.out.print(15); java.lang.System.out.println:(() => Unit)}();
|
||||
{System.out.print(16); java.lang.System.out.println()};
|
||||
|
||||
{System.out.print(20)}; test0.bar.System.out.println();
|
||||
{System.out.print(21); test0}.bar.System.out.println();
|
||||
{System.out.print(22); test0.bar}.System.out.println();
|
||||
{System.out.print(23); test0.bar.System}.out.println();
|
||||
{System.out.print(24); test0.bar.System.out}.println();
|
||||
{System.out.print(25); test0.bar.System.out.println:(() => Unit)}();
|
||||
{System.out.print(26); test0.bar.System.out.println()};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//############################################################################
|
|
@ -14,3 +14,15 @@ hello
|
|||
[0,bye]
|
||||
>>> bug Test0
|
||||
|
||||
<<< bug Test1
|
||||
10
|
||||
14
|
||||
15
|
||||
16
|
||||
20
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
>>> bug Test1
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import java.lang.System; // to avoid name clash with .NET's library
|
||||
|
||||
//############################################################################
|
||||
// Test 0 - Array creation
|
||||
// Test 0 - Array Creation
|
||||
|
||||
object Test0Test {
|
||||
def println[A](xs: Array[A]): Unit = {
|
||||
|
@ -48,6 +48,45 @@ object Test0Test {
|
|||
}
|
||||
}
|
||||
|
||||
//############################################################################
|
||||
// Test 1 - Block Qualifiers
|
||||
|
||||
package test1.bar {
|
||||
|
||||
object System {
|
||||
val out: PrintStream = new PrintStream();
|
||||
}
|
||||
|
||||
class PrintStream() {
|
||||
def println(): Unit = {
|
||||
java.lang.System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object Test1Test {
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
{System.out.print(10)}; java.lang.System.out.println();
|
||||
// {System.out.print(11); java}.lang.System.out.println();
|
||||
// {System.out.print(12); java.lang}.System.out.println();
|
||||
// {System.out.print(13); java.lang.System}.out.println();
|
||||
{System.out.print(14); java.lang.System.out}.println();
|
||||
{System.out.print(15); java.lang.System.out.println:(() => Unit)}();
|
||||
{System.out.print(16); java.lang.System.out.println()};
|
||||
|
||||
{System.out.print(20)}; test1.bar.System.out.println();
|
||||
// {System.out.print(21); test1}.bar.System.out.println();
|
||||
// {System.out.print(22); test1.bar}.System.out.println();
|
||||
{System.out.print(23); test1.bar.System}.out.println();
|
||||
{System.out.print(24); test1.bar.System.out}.println();
|
||||
{System.out.print(25); test1.bar.System.out.println:(() => Unit)}();
|
||||
{System.out.print(26); test1.bar.System.out.println()};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//############################################################################
|
||||
// Main
|
||||
|
||||
|
@ -73,6 +112,7 @@ object Test {
|
|||
def main(args: Array[String]): Unit = {
|
||||
|
||||
test("Test0" , Test0Test.main(args));
|
||||
test("Test1" , Test1Test.main(args));
|
||||
|
||||
if (errors > 0) {
|
||||
System.out.println();
|
||||
|
|
Loading…
Reference in New Issue