diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-05-15 15:44:54 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-05-15 15:44:54 +0000 |
commit | 10830eaae2955766378369b8d1bcc0e6963b9b7f (patch) | |
tree | 595d0d162d94eda17062d4d13710378930b7ac7f /test/files/pos | |
parent | fbf991833d5ec0d9890ac1e7df9f53209e313552 (diff) | |
download | scala-10830eaae2955766378369b8d1bcc0e6963b9b7f.tar.gz scala-10830eaae2955766378369b8d1bcc0e6963b9b7f.tar.bz2 scala-10830eaae2955766378369b8d1bcc0e6963b9b7f.zip |
1.4-related cleanup and reorganization.
Removed a bunch of now useless 1.4 code, merged
back jvm5-specific partest tests into the
general jvm tests, documentation updates.
Diffstat (limited to 'test/files/pos')
41 files changed, 210 insertions, 0 deletions
diff --git a/test/files/pos/chang/Outer.java b/test/files/pos/chang/Outer.java new file mode 100644 index 0000000000..acdb4e2904 --- /dev/null +++ b/test/files/pos/chang/Outer.java @@ -0,0 +1,11 @@ +package com.netgents.hello; + +public class Outer<A> { + + public Inner inner = new Inner(); + + public class Inner { + + public A a; + } +} diff --git a/test/files/pos/chang/Test.scala b/test/files/pos/chang/Test.scala new file mode 100644 index 0000000000..9bb745e377 --- /dev/null +++ b/test/files/pos/chang/Test.scala @@ -0,0 +1,3 @@ +object Test extends Application { + new com.netgents.hello.Outer[String] +} diff --git a/test/files/pos/ilya/J.java b/test/files/pos/ilya/J.java new file mode 100644 index 0000000000..c44169ca1b --- /dev/null +++ b/test/files/pos/ilya/J.java @@ -0,0 +1,14 @@ +package test; + +class Foo { +} + +class Boo<T extends Foo>{} + +class Bar<BooT extends Boo<FooT>, FooT extends Foo>{ + private final int myInt; + + public Bar(int i) { + myInt = i; + } +}
\ No newline at end of file diff --git a/test/files/pos/ilya/S.scala b/test/files/pos/ilya/S.scala new file mode 100644 index 0000000000..952c004ccc --- /dev/null +++ b/test/files/pos/ilya/S.scala @@ -0,0 +1,5 @@ +package test + +class ScBar[BooT <: Boo[FooT], FooT <: Foo](i: Int) extends Bar[BooT, FooT](i) { + +} diff --git a/test/files/pos/ilya2/A.scala b/test/files/pos/ilya2/A.scala new file mode 100644 index 0000000000..923b50f04d --- /dev/null +++ b/test/files/pos/ilya2/A.scala @@ -0,0 +1,3 @@ +class A { + def foo = new B().bar(null) +} diff --git a/test/files/pos/ilya2/B.java b/test/files/pos/ilya2/B.java new file mode 100644 index 0000000000..4771493fdd --- /dev/null +++ b/test/files/pos/ilya2/B.java @@ -0,0 +1,6 @@ +public class B { + public int bar(@Nullable final Object o) { + return 42; + } + +} diff --git a/test/files/pos/ilya2/Nullable.java b/test/files/pos/ilya2/Nullable.java new file mode 100644 index 0000000000..ebbb013d7e --- /dev/null +++ b/test/files/pos/ilya2/Nullable.java @@ -0,0 +1,7 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE}) +public @interface Nullable { + String value() default ""; +} diff --git a/test/files/pos/signatures/Test.java b/test/files/pos/signatures/Test.java new file mode 100644 index 0000000000..8ecac29910 --- /dev/null +++ b/test/files/pos/signatures/Test.java @@ -0,0 +1,11 @@ +import scala.collection.mutable.Vector; +import test.Outer; + +/* Test correct generation of java signatures. The Outer class should not + * have a Java signature attribute for the inner method definition. Trait + * Mutable should have one, even though it is also a nested definition. + * (but for classes there is a way to tell about nesting to the JVM). + */ +class Test { + Outer o = new Outer(); +}
\ No newline at end of file diff --git a/test/files/pos/signatures/sig.scala b/test/files/pos/signatures/sig.scala new file mode 100644 index 0000000000..4236f27bed --- /dev/null +++ b/test/files/pos/signatures/sig.scala @@ -0,0 +1,12 @@ +package test + +/* Tests correct generation of Java signatures. The local method 'bar' should + * not get a generic signature, as it may refer to type parameters of the enclosing + * method, and the JVM does not know about nested methods. + */ +class Outer { + def foo[A, B](x: A, y: B) = { + def bar[X](x1: A, y1: B, z1: X) = z1 + bar(x, y, 10) + } +} diff --git a/test/files/pos/t0695/JavaClass.java b/test/files/pos/t0695/JavaClass.java new file mode 100644 index 0000000000..a765f7e324 --- /dev/null +++ b/test/files/pos/t0695/JavaClass.java @@ -0,0 +1,5 @@ +public class JavaClass<A> { + class InnerClass { + public A method() { return null; } + } +} diff --git a/test/files/pos/t0695/Test.scala b/test/files/pos/t0695/Test.scala new file mode 100644 index 0000000000..7318867bf7 --- /dev/null +++ b/test/files/pos/t0695/Test.scala @@ -0,0 +1,3 @@ +object Test extends JavaClass[AnyRef] { + var field: InnerClass = null +} diff --git a/test/files/pos/t1101/J.java b/test/files/pos/t1101/J.java new file mode 100644 index 0000000000..2bc1d53e09 --- /dev/null +++ b/test/files/pos/t1101/J.java @@ -0,0 +1 @@ +class J { enum E { E1 } } diff --git a/test/files/pos/t1101/S.scala b/test/files/pos/t1101/S.scala new file mode 100644 index 0000000000..af7a591e58 --- /dev/null +++ b/test/files/pos/t1101/S.scala @@ -0,0 +1 @@ +class S { val x: J.E = null; System.out.println(J.E.E1) } diff --git a/test/files/pos/t1102/J.java b/test/files/pos/t1102/J.java new file mode 100644 index 0000000000..530102b91c --- /dev/null +++ b/test/files/pos/t1102/J.java @@ -0,0 +1,4 @@ +class J { + enum E { E1 } + void foo(E e) { } +} diff --git a/test/files/pos/t1102/S.scala b/test/files/pos/t1102/S.scala new file mode 100644 index 0000000000..9beee8d901 --- /dev/null +++ b/test/files/pos/t1102/S.scala @@ -0,0 +1 @@ +class S(j:J) { j.foo(J.E.E1) } diff --git a/test/files/pos/t1150/J.java b/test/files/pos/t1150/J.java new file mode 100644 index 0000000000..68fa04a178 --- /dev/null +++ b/test/files/pos/t1150/J.java @@ -0,0 +1,4 @@ +class J { + static void bbb (Boolean b) { } + static void ddd (Double d) { } +} diff --git a/test/files/pos/t1150/S.scala b/test/files/pos/t1150/S.scala new file mode 100644 index 0000000000..41dd064037 --- /dev/null +++ b/test/files/pos/t1150/S.scala @@ -0,0 +1,4 @@ +object S { + J.bbb(new java.lang.Boolean(true)) + J.ddd(new java.lang.Double(0)) +} diff --git a/test/files/pos/t1152/J.java b/test/files/pos/t1152/J.java new file mode 100644 index 0000000000..6e562e573d --- /dev/null +++ b/test/files/pos/t1152/J.java @@ -0,0 +1 @@ +class J { java.util.List<String> k = null; } diff --git a/test/files/pos/t1152/S.scala b/test/files/pos/t1152/S.scala new file mode 100644 index 0000000000..7f751c5090 --- /dev/null +++ b/test/files/pos/t1152/S.scala @@ -0,0 +1,2 @@ +class S2(fn:(J)=>Any) +object S { new S2(_.k) } diff --git a/test/files/pos/t1176/J.java b/test/files/pos/t1176/J.java new file mode 100644 index 0000000000..0d82c75fcb --- /dev/null +++ b/test/files/pos/t1176/J.java @@ -0,0 +1,4 @@ +class J { + J() { } + J( java.util.Collection<?> collection ) { } +} diff --git a/test/files/pos/t1176/S.scala b/test/files/pos/t1176/S.scala new file mode 100644 index 0000000000..a7fc3e0cea --- /dev/null +++ b/test/files/pos/t1176/S.scala @@ -0,0 +1 @@ +class S { new J } diff --git a/test/files/pos/t1186/t1186.java b/test/files/pos/t1186/t1186.java new file mode 100644 index 0000000000..c1bfcecab8 --- /dev/null +++ b/test/files/pos/t1186/t1186.java @@ -0,0 +1,8 @@ +import scala.collection.immutable.Map; + +class Test { + + void foo() { + Map<String, String> map = null; + } +}
\ No newline at end of file diff --git a/test/files/pos/t1196/J.java b/test/files/pos/t1196/J.java new file mode 100644 index 0000000000..2ec7a711bb --- /dev/null +++ b/test/files/pos/t1196/J.java @@ -0,0 +1 @@ +class J { static void foo(Class c) { } } diff --git a/test/files/pos/t1196/S.scala b/test/files/pos/t1196/S.scala new file mode 100644 index 0000000000..f17cd249a7 --- /dev/null +++ b/test/files/pos/t1196/S.scala @@ -0,0 +1 @@ +object S { J.foo(null) } diff --git a/test/files/pos/t1197/J.java b/test/files/pos/t1197/J.java new file mode 100644 index 0000000000..b4e0a4255c --- /dev/null +++ b/test/files/pos/t1197/J.java @@ -0,0 +1,2 @@ +class J { interface K { } } + diff --git a/test/files/pos/t1197/S.scala b/test/files/pos/t1197/S.scala new file mode 100644 index 0000000000..7c9c15440f --- /dev/null +++ b/test/files/pos/t1197/S.scala @@ -0,0 +1,2 @@ +object S extends J.K + diff --git a/test/files/pos/t1203/J.java b/test/files/pos/t1203/J.java new file mode 100644 index 0000000000..7fae118e04 --- /dev/null +++ b/test/files/pos/t1203/J.java @@ -0,0 +1 @@ +interface J { int j = 200 ; } diff --git a/test/files/pos/t1203/S.scala b/test/files/pos/t1203/S.scala new file mode 100644 index 0000000000..68eac4bf6d --- /dev/null +++ b/test/files/pos/t1203/S.scala @@ -0,0 +1 @@ +object S { J.j } diff --git a/test/files/pos/t1230/J.java b/test/files/pos/t1230/J.java new file mode 100644 index 0000000000..35aefd2505 --- /dev/null +++ b/test/files/pos/t1230/J.java @@ -0,0 +1 @@ +class J { public int foo ; } diff --git a/test/files/pos/t1230/S.scala b/test/files/pos/t1230/S.scala new file mode 100644 index 0000000000..f8a691b6de --- /dev/null +++ b/test/files/pos/t1230/S.scala @@ -0,0 +1 @@ +object S extends Application { (new J).foo = 5 } diff --git a/test/files/pos/t1231/J.java b/test/files/pos/t1231/J.java new file mode 100644 index 0000000000..1dfc9490eb --- /dev/null +++ b/test/files/pos/t1231/J.java @@ -0,0 +1 @@ +enum J { j1 }
\ No newline at end of file diff --git a/test/files/pos/t1231/S.scala b/test/files/pos/t1231/S.scala new file mode 100644 index 0000000000..ee08866e04 --- /dev/null +++ b/test/files/pos/t1231/S.scala @@ -0,0 +1 @@ +object S extends Application { println(J.j1) } diff --git a/test/files/pos/t1232/J.java b/test/files/pos/t1232/J.java new file mode 100755 index 0000000000..af3aad928d --- /dev/null +++ b/test/files/pos/t1232/J.java @@ -0,0 +1,2 @@ +package j; +public class J { public enum E { e1 } }
\ No newline at end of file diff --git a/test/files/pos/t1232/J2.java b/test/files/pos/t1232/J2.java new file mode 100755 index 0000000000..dc117d360f --- /dev/null +++ b/test/files/pos/t1232/J2.java @@ -0,0 +1,2 @@ +import s.S; +class J2 { }
\ No newline at end of file diff --git a/test/files/pos/t1232/S.scala b/test/files/pos/t1232/S.scala new file mode 100755 index 0000000000..1b6bca7327 --- /dev/null +++ b/test/files/pos/t1232/S.scala @@ -0,0 +1,2 @@ +package s +class S { j.J.E.e1 } diff --git a/test/files/pos/t1235/Test.java b/test/files/pos/t1235/Test.java new file mode 100644 index 0000000000..7bb83a8491 --- /dev/null +++ b/test/files/pos/t1235/Test.java @@ -0,0 +1,9 @@ +import scala.collection.immutable.HashMap; + +public class Test { + + void foo() { + new HashMap<String, String>(); + } +} + diff --git a/test/files/pos/t1254/t1254.java b/test/files/pos/t1254/t1254.java new file mode 100644 index 0000000000..25b733cf28 --- /dev/null +++ b/test/files/pos/t1254/t1254.java @@ -0,0 +1,28 @@ +/* Taken from ticket #1254. Tests Java signatures in mirror classes and that + Nothing is translated to Nothing$. +*/ + +import scala.None; + +// This compiles with javac but fails with Eclipse java compiler: +// 'The type scala.Nothing cannot be resolved. It is indirectly referenced from required .class files' +class NothingBug3 { + public NothingBug3() { + scala.Option<?> o = scala.None$.MODULE$; + + test(o); + None.toLeft(new scala.Function0<Integer>() { + public Integer apply() { return 0; } + }); + } + + public <T>void test(scala.Option<T> f) {} +} + +// This compiles with javac but fails with Eclipse java compiler: +// 'The type scala.Nothing cannot be resolved. It is indirectly referenced from required .class files' +class NothingBug4 { + public NothingBug4() { + scala.Option o = scala.None$.MODULE$; + } +} diff --git a/test/files/pos/t1263/Test.java b/test/files/pos/t1263/Test.java new file mode 100644 index 0000000000..0eb43e881a --- /dev/null +++ b/test/files/pos/t1263/Test.java @@ -0,0 +1,16 @@ +package test; + +import java.rmi.RemoteException; + +import test.Map; + +public class Test implements Map<String, String> { + public Map<String, String>.MapTo plus(String o) { + return null; + } + + public int $tag() throws RemoteException { + return 0; + } +} + diff --git a/test/files/pos/t1263/test.scala b/test/files/pos/t1263/test.scala new file mode 100644 index 0000000000..92d8c1cdfa --- /dev/null +++ b/test/files/pos/t1263/test.scala @@ -0,0 +1,10 @@ +package test + +trait Map[A, +B] { + def plus(key: A): MapTo = new MapTo(key) + + class MapTo(key: A) { + def arrow [B1 >: B](value: B1) = null + } +} + diff --git a/test/files/pos/t1711/Seq.scala b/test/files/pos/t1711/Seq.scala new file mode 100644 index 0000000000..c18f05cd73 --- /dev/null +++ b/test/files/pos/t1711/Seq.scala @@ -0,0 +1,12 @@ +package com + +object Sequence { + + def filteringFunction[V](filter: V => Boolean): List[V] => List[V] = { + def include(v: V) = + filter(v) + (l: List[V]) => l.filter(include) + } + +} + diff --git a/test/files/pos/t1711/Test.java b/test/files/pos/t1711/Test.java new file mode 100644 index 0000000000..5ec0f2297c --- /dev/null +++ b/test/files/pos/t1711/Test.java @@ -0,0 +1,6 @@ +import com.Sequence; + +public class Test { + void foo() { + } +} |