From cf37737f56db7bc2f7429f78328dc5eea1716356 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Thu, 13 Apr 2017 14:32:05 +0200 Subject: fix #2253: avoid exception with refinement types --- compiler/src/dotty/tools/dotc/transform/patmat/Space.scala | 1 + tests/patmat/i2253.scala | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 tests/patmat/i2253.scala diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 229545a57..fe2983896 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -537,6 +537,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic { tp.refinedName, tpb.derivedTypeBounds(follow(lo, false), follow(hi, true)) ) + case tp => tp } case _ => tp } diff --git a/tests/patmat/i2253.scala b/tests/patmat/i2253.scala new file mode 100644 index 000000000..8394a86df --- /dev/null +++ b/tests/patmat/i2253.scala @@ -0,0 +1,7 @@ +sealed trait S +object O extends S +trait T + +class Test { + def m(s: S { val x: Int }) = s match { case _: T => ; } +} \ No newline at end of file -- cgit v1.2.3