diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-02 18:37:28 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-02 18:39:36 +0100 |
commit | 306c31214b8f729b810d1f162da20ff8ca6a2848 (patch) | |
tree | bdfcd4c55151463e1b2ddae4413d6f8ea69e38b3 /tests | |
parent | 47d208448e614125446c7f294f8231c3fb7108d6 (diff) | |
download | dotty-306c31214b8f729b810d1f162da20ff8ca6a2848.tar.gz dotty-306c31214b8f729b810d1f162da20ff8ca6a2848.tar.bz2 dotty-306c31214b8f729b810d1f162da20ff8ca6a2848.zip |
Fix #1751: Make dominator work after erasure
i1751.scala shows a case where we need to compute the approximation
of an or-type during erasure. This can lead to an empty set of common
classes because Any does not exist anymore after erasure.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/i1751.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/pos/i1751.scala b/tests/pos/i1751.scala new file mode 100644 index 000000000..d51cdc65d --- /dev/null +++ b/tests/pos/i1751.scala @@ -0,0 +1,17 @@ +trait Break { protected val break: Int; } +case class BreakImpl(protected val break: Int) extends Break {} +object Test { + def f2(x: Break) = x match { + case BreakImpl(x) => BreakImpl + case _ => -1 + } + def f4(x: Any) = x match { + case BreakImpl(x) => x + case _ => -1 + } + def main(args: Array[String]): Unit = { + val break = BreakImpl(22) + assert(f2(break) == 22) + assert(f4(break) == 22) + } +} |