diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-10 18:50:48 +0700 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-01-10 18:50:48 +0700 |
commit | 2144462b39a6d92d7c3653e9bb242d116a60caba (patch) | |
tree | bd196752348fbab68892644af3f3bdb3fd0e97b3 /tests/pos | |
parent | be6464366fdbccc12623970445d8d5e8deff3f3f (diff) | |
download | dotty-2144462b39a6d92d7c3653e9bb242d116a60caba.tar.gz dotty-2144462b39a6d92d7c3653e9bb242d116a60caba.tar.bz2 dotty-2144462b39a6d92d7c3653e9bb242d116a60caba.zip |
Fix #1891: Don't add redundant constraint
Before adding a constraint, make sure there is no way
the two types are already in a subtype relation.
Adding redundant constraints is problematic because we
might introduce cycles. See i1891.scala for a test.
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/i1891.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/pos/i1891.scala b/tests/pos/i1891.scala new file mode 100644 index 000000000..b178c256b --- /dev/null +++ b/tests/pos/i1891.scala @@ -0,0 +1,11 @@ +object Test { + class CC2[A, B](a: A, b: B) + + type T2[A, B] = CC2[A, B] + + class ArrowAssoc[A](val self: A) { + @inline def f[B](y: B): CC2[A, B] = new CC2(self, y) + } + + def foo = (new ArrowAssoc(1)).f(2) +} |