summaryrefslogtreecommitdiff
path: root/test/files/pos/t0764.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t0764.scala')
-rw-r--r--test/files/pos/t0764.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/pos/t0764.scala b/test/files/pos/t0764.scala
new file mode 100644
index 0000000000..f1084f5ff8
--- /dev/null
+++ b/test/files/pos/t0764.scala
@@ -0,0 +1,27 @@
+class Top[A] {
+ type AType = A
+}
+
+trait Node { outer =>
+ type T <: Node
+ def prepend = new Node { type T = outer.type }
+}
+
+class Main[NextType <: Node](value: Node { type T = NextType })
+ extends Top[Node { type T = NextType }] {
+
+ new Main[AType]( (value: AType).prepend )
+}
+
+/* this used to be a neg test, even though it should've compiled
+SI-8177 fixed this.
+
+Behold the equivalent program which type checks without the fix for SI-8177.
+(Expand type alias, convert type member to type param;
+note the covariance to encode subtyping on type members.)
+
+class Node[+T <: Node[_]] { def prepend = new Node[this.type] }
+class Main[NextType <: Node[_]](value: Node[NextType]) {
+ new Main(value.prepend)
+}
+*/ \ No newline at end of file