diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-13 06:05:27 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-13 06:05:27 -0700 |
commit | 20f701bf504530cb12e9d24e2dd66fa42244664d (patch) | |
tree | 2d5cd89f0fad0f9adb9b01cceb3ba535f40171cd /test | |
parent | cfd874ac173ca8d6542921aeea60e1f5ace80b9d (diff) | |
parent | f5e71796d5b964026f5723318d29be5b189b442e (diff) | |
download | scala-20f701bf504530cb12e9d24e2dd66fa42244664d.tar.gz scala-20f701bf504530cb12e9d24e2dd66fa42244664d.tar.bz2 scala-20f701bf504530cb12e9d24e2dd66fa42244664d.zip |
Merge pull request #1296 from paulp/210-errors-and-trees
210 errors and trees
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/names-defaults-neg.check | 2 | ||||
-rw-r--r-- | test/files/neg/wrong-args-for-none.check | 4 | ||||
-rw-r--r-- | test/files/neg/wrong-args-for-none.scala | 6 | ||||
-rw-r--r-- | test/files/pos/z1720.scala | 16 | ||||
-rw-r--r-- | test/pending/pos/t3943/Outer_1.java | 14 | ||||
-rw-r--r-- | test/pending/pos/t3943/test_2.scala | 8 |
6 files changed, 49 insertions, 1 deletions
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 2809350855..f3c45a6aa0 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -76,7 +76,7 @@ and method f in object t8 of type (a: Int, b: Object)String match argument types (a: Int,b: String) and expected result type Any println(t8.f(a = 0, b = "1")) // ambigous reference ^ -names-defaults-neg.scala:69: error: wrong number of arguments for <none>: (x: Int, y: String)A1 +names-defaults-neg.scala:69: error: wrong number of arguments for pattern A1(x: Int,y: String) A1() match { case A1(_) => () } ^ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])T[T[List[T[X forSome { type X }]]]] exist so that it can be applied to arguments (List[Int]) diff --git a/test/files/neg/wrong-args-for-none.check b/test/files/neg/wrong-args-for-none.check new file mode 100644 index 0000000000..d3b2d572ab --- /dev/null +++ b/test/files/neg/wrong-args-for-none.check @@ -0,0 +1,4 @@ +wrong-args-for-none.scala:5: error: wrong number of arguments for pattern Test.Foo(x: Int,y: Int) + def f(x: Any) = x match { case Bar(Foo(5)) => } + ^ +one error found diff --git a/test/files/neg/wrong-args-for-none.scala b/test/files/neg/wrong-args-for-none.scala new file mode 100644 index 0000000000..1caa4782a3 --- /dev/null +++ b/test/files/neg/wrong-args-for-none.scala @@ -0,0 +1,6 @@ +object Test { + case class Foo(x: Int, y: Int) + case class Bar(x: AnyRef) + + def f(x: Any) = x match { case Bar(Foo(5)) => } +} diff --git a/test/files/pos/z1720.scala b/test/files/pos/z1720.scala new file mode 100644 index 0000000000..7394d428c1 --- /dev/null +++ b/test/files/pos/z1720.scala @@ -0,0 +1,16 @@ +package test + +class Thing { + def info: Info[this.type] = InfoRepository.getInfo(this) + def info2: Info[this.type] = { + def self: this.type = this + InfoRepository.getInfo(self) + } +} + +trait Info[T] +case class InfoImpl[T](thing: T) extends Info[T] + +object InfoRepository { + def getInfo(t: Thing): Info[t.type] = InfoImpl(t) +} diff --git a/test/pending/pos/t3943/Outer_1.java b/test/pending/pos/t3943/Outer_1.java new file mode 100644 index 0000000000..56c8cc7f85 --- /dev/null +++ b/test/pending/pos/t3943/Outer_1.java @@ -0,0 +1,14 @@ +public class Outer_1<E> { + abstract class Inner { + abstract public void foo(E e); + } +} + +class Child extends Outer_1<String> { + // the implicit prefix for Inner is Outer<E> instead of Outer<String> + public Inner getInner() { + return new Inner() { + public void foo(String e) { System.out.println("meh "+e); } + }; + } +} diff --git a/test/pending/pos/t3943/test_2.scala b/test/pending/pos/t3943/test_2.scala new file mode 100644 index 0000000000..a19db8b226 --- /dev/null +++ b/test/pending/pos/t3943/test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + val x: Child = new Child + x.getInner.foo("meh") +// ^ +// error: type mismatch; +// found : java.lang.String("meh") +// required: E +} |