diff options
author | Martin Odersky <odersky@gmail.com> | 2015-01-08 11:36:32 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-01-08 11:36:38 +0100 |
commit | 0a35baa8a1ed91a71398887ae7a1a08910e4faf0 (patch) | |
tree | 5bdf3227004abe407df33f1b6bd5075f43b81cc2 /tests/pending | |
parent | 1309f0fab02337788fba656be19a432d80d59565 (diff) | |
download | dotty-0a35baa8a1ed91a71398887ae7a1a08910e4faf0.tar.gz dotty-0a35baa8a1ed91a71398887ae7a1a08910e4faf0.tar.bz2 dotty-0a35baa8a1ed91a71398887ae7a1a08910e4faf0.zip |
New scheme for subtyping refined types.
- Instead of rebasing, use the DeBrujn level of a RefiendThis.
- Make sure lower type is a singleton by skolemizing it if necessary.
- Do the correct rebinding of the upper type's RefinedThis.
Remarks:
- The new scheme discovered quite a lot of errors which are mostly fixded in
other commits of this branch. i0268 (GADT matching) still does not work, moved to pending.
- Some optimizations are currently missing:
(1) fast path refined subtyping
(2) faster operations for substituting refined thistypes which
explot the fact that RefinedThis is relatively rare.
Diffstat (limited to 'tests/pending')
-rw-r--r-- | tests/pending/pos/i0268.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pending/pos/i0268.scala b/tests/pending/pos/i0268.scala new file mode 100644 index 000000000..6ac0c5c90 --- /dev/null +++ b/tests/pending/pos/i0268.scala @@ -0,0 +1,15 @@ +package typespatmat + +sealed trait Box2[T] +final case class Int2(x: Int) extends Box2[Int] +final case class Str2(x: String) + extends Box2[String] +final case class Gen[T](x: T) extends Box2[T] + +object Box2 { + def double2[T](x: Box2[T]): T = x match { + case Int2(i) => i * 2 + case Str2(s) => s + s + case Gen(x) => x + } +} |