diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-16 14:35:48 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-11-16 14:35:48 -0800 |
commit | 3068ddeadc8a07f9173ba204e415b37945452037 (patch) | |
tree | 5bcec15fd17c503f462f9c218df858effa479f53 /test/files/pos | |
parent | 4444369ddf39176dcfae4bcf1901697a6ccdfd42 (diff) | |
parent | 085b6a5bbed3839238c5cc0434281cf8e4c1ad19 (diff) | |
download | scala-3068ddeadc8a07f9173ba204e415b37945452037.tar.gz scala-3068ddeadc8a07f9173ba204e415b37945452037.tar.bz2 scala-3068ddeadc8a07f9173ba204e415b37945452037.zip |
Merge pull request #1622 from adriaanm/paulp-issue/5330-2
SI-5330, SI-6014 deal with existential self-type
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t5330.scala | 22 | ||||
-rw-r--r-- | test/files/pos/t5330b.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t5330c.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t6014.scala | 13 |
4 files changed, 46 insertions, 0 deletions
diff --git a/test/files/pos/t5330.scala b/test/files/pos/t5330.scala new file mode 100644 index 0000000000..813acd4b83 --- /dev/null +++ b/test/files/pos/t5330.scala @@ -0,0 +1,22 @@ +trait FM[A] { + def map(f: A => Any) +} + +trait M[A] extends FM[A] { + def map(f: A => Any) +} + +trait N[A] extends FM[A] + +object test { + def kaboom(xs: M[_]) = xs map (x => ()) // missing parameter type. + + def okay1[A](xs: M[A]) = xs map (x => ()) + def okay2(xs: FM[_]) = xs map (x => ()) + def okay3(xs: N[_]) = xs map (x => ()) +} + +class CC2(xs: List[_]) { + def f(x1: Any, x2: Any) = null + def g = xs map (x => f(x, x)) +} diff --git a/test/files/pos/t5330b.scala b/test/files/pos/t5330b.scala new file mode 100644 index 0000000000..dbeb165cd8 --- /dev/null +++ b/test/files/pos/t5330b.scala @@ -0,0 +1,6 @@ +abstract trait Base { + def foo: this.type +}; +class Derived[T] extends Base { + def foo: Nothing = sys.error("!!!") +} diff --git a/test/files/pos/t5330c.scala b/test/files/pos/t5330c.scala new file mode 100644 index 0000000000..af31f3dfd1 --- /dev/null +++ b/test/files/pos/t5330c.scala @@ -0,0 +1,5 @@ +object t5330c { + val s: Set[_ >: Char] = Set('A') + s forall ("ABC" contains _) + s.forall( c => "ABC".toSeq.contains( c )) +} diff --git a/test/files/pos/t6014.scala b/test/files/pos/t6014.scala new file mode 100644 index 0000000000..46e03bb552 --- /dev/null +++ b/test/files/pos/t6014.scala @@ -0,0 +1,13 @@ +object Test { + case class CC[T](key: T) + type Alias[T] = Seq[CC[T]] + + def f(xs: Seq[CC[_]]) = xs map { case CC(x) => CC(x) } // ok + def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // fails + // ./a.scala:11: error: missing parameter type for expanded function + // The argument types of an anonymous function must be fully known. (SLS 8.5) + // Expected type was: ? + // def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // fails + // ^ + // one error found +}
\ No newline at end of file |