From 2144462b39a6d92d7c3653e9bb242d116a60caba Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 10 Jan 2017 18:50:48 +0700 Subject: 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. --- tests/pos/i1891.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/pos/i1891.scala (limited to 'tests') 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) +} -- cgit v1.2.3