aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/test5.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-20 22:00:29 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-20 22:00:45 +0100
commite51b8845fb20fe3a4e1c655d4b72e2833906bbc2 (patch)
tree91bc16867d7a709566d8be80902b3256294cf338 /tests/pos/test5.scala
parent581fee04f808d6f7759f98358e7475e6a58138e3 (diff)
downloaddotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.gz
dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.bz2
dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.zip
The big pending/pos test triage
Diffstat (limited to 'tests/pos/test5.scala')
-rw-r--r--tests/pos/test5.scala68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/pos/test5.scala b/tests/pos/test5.scala
new file mode 100644
index 000000000..c19478048
--- /dev/null
+++ b/tests/pos/test5.scala
@@ -0,0 +1,68 @@
+import scala._;
+
+object test {
+
+ trait F[If] {}
+
+ def f[Jf](h: Jf):F[Jf] = f[Jf](h);
+
+ trait G[Ig] {}
+
+ def g[Jg](h: Jg):G[Jg] = g[Jg](h);
+
+ class M[P]() {
+ abstract class I[X]() {
+ // Methods to check the type X and P as seen from instances of I
+ def chk_ix(x: X): Unit = ();
+ def chk_ip(p: P): Unit;
+
+ // Value with type X as seen from instances of I
+ def val_ix: X = val_ix;
+ }
+
+ val i:I[G[P]] = null;
+
+ // Values with types P and i.X as seen from instances of M
+ def val_mp: P = val_mp;
+ def val_mix: G[P] = g[P](val_mp);
+ }
+
+ class N[Q]() extends M[F[Q]]() {
+ val j:J[G[Q]] = null;
+
+ abstract class J[Y]() extends I[G[Y]]() {
+ // Values with types Y and X as seen from instances of J
+ def val_jy: Y = val_jy;
+ def val_jx: G[Y] = g[Y](val_jy);
+
+ // Check type P
+ chk_ip(val_mp);
+ chk_ip(val_np);
+ }
+
+ // Values with types Q, X.P, i.X, j.Y and j.X as seen from instances of N
+ def val_nq: Q = val_nq;
+ def val_np: F[Q] = f[Q](val_nq);
+ def val_nix: G[F[Q]] = g[F[Q]](val_np);
+ def val_njy: G[Q] = g[Q](val_nq);
+ def val_njx: G[G[Q]] = g[G[Q]](val_njy);
+
+ // Check type i.P
+ i.chk_ip(val_mp);
+ i.chk_ip(val_np);
+
+ // Check type j.P
+ j.chk_ip(val_mp);
+ j.chk_ip(val_np);
+
+ // Check type i.X
+ i.chk_ix(i.val_ix);
+ i.chk_ix(val_mix);
+ i.chk_ix(val_nix);
+
+ // Check j.X
+ j.chk_ix(j.val_ix);
+ j.chk_ix(j.val_jx);
+ j.chk_ix(val_njx);
+ }
+}