aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-11-25 00:07:13 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-11-25 02:11:17 +0100
commit81b7ed9abb9627d541b795990980f4431b459380 (patch)
tree86b9976cdcaee86082e9d8c35ed24fe59d9c2cc3 /tests
parent4463f5e705480c7da188695abdb0ccacf452103c (diff)
downloaddotty-81b7ed9abb9627d541b795990980f4431b459380.tar.gz
dotty-81b7ed9abb9627d541b795990980f4431b459380.tar.bz2
dotty-81b7ed9abb9627d541b795990980f4431b459380.zip
isSubtype: try to dealias TypeRefs before recursively checking the prefixes
As demonstrated by tests/pos/hk-deep-subtype.scala, we can avoid some deep subtype recursions that result in stack overflows by doing this. Fix #943.
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/hk-deep-subtype.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pos/hk-deep-subtype.scala b/tests/pos/hk-deep-subtype.scala
new file mode 100644
index 000000000..202329a79
--- /dev/null
+++ b/tests/pos/hk-deep-subtype.scala
@@ -0,0 +1,15 @@
+// Minimized from scala.collection.generic.GenTraversableFactory plus dependencies
+import scala.annotation.unchecked.uncheckedVariance
+
+trait GT[A] extends GTT[A, GT]
+
+trait HNB[B]
+trait GTT[+C, DD[X] <: GT[X]] extends HNB[DD[C] @uncheckedVariance] // Can be any annotation and still crash
+
+class GTF[EE[X] <: GT[X] with GTT[X, EE]]
+{
+ def foo[F]: EE[F] = ???
+ def bar[G](f: G): EE[G] = ???
+
+ def tabulate: EE[EE[Int]] = bar(foo)
+}