From 427b82648422e4118c68f34e81c94deca3755deb Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 10 Feb 2014 13:43:30 -0800 Subject: SI-8177 refine embeddedSymbols We look for any prefix that has a refinement class for a type symbol. This includes ThisTypes, which were not considered before. pos/t8177g.scala, neg/t0764*scala now compile, as they should Additional test cases contributed by Jason & Paul. --- test/files/pos/t0764.scala | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/files/pos/t0764.scala (limited to 'test/files/pos/t0764.scala') 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 -- cgit v1.2.3