diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-26 06:00:20 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-26 06:00:20 +0000 |
commit | 6d22805793cd25427469cceb89258fdbca42630b (patch) | |
tree | 557d028059713104df1d15af87af17326d0943ab /test/files/run/bug3714.scala | |
parent | cab41b68581f32e56491b4bfdcbb931a4abe3689 (diff) | |
download | scala-6d22805793cd25427469cceb89258fdbca42630b.tar.gz scala-6d22805793cd25427469cceb89258fdbca42630b.tar.bz2 scala-6d22805793cd25427469cceb89258fdbca42630b.zip |
Case accessors are always public else the patte...
Case accessors are always public else the pattern matcher goes south. A
more discriminating fix may be possible at some point, but it looks to
be an involved endeavor. Closes #3714, review by odersky.
Diffstat (limited to 'test/files/run/bug3714.scala')
-rw-r--r-- | test/files/run/bug3714.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/bug3714.scala b/test/files/run/bug3714.scala new file mode 100644 index 0000000000..2d600f97f1 --- /dev/null +++ b/test/files/run/bug3714.scala @@ -0,0 +1,33 @@ +trait Break { + protected val break: Int; +} + +case class BreakImpl(protected val break: Int) extends Break { } + +object Test { + // def f1(x: Break) = x match { + // case b: BreakImpl => b.break + // case b => -1 + // } + def f2(x: Break) = x match { + case BreakImpl(x) => x + case _ => -1 + } + // def f3(x: Any) = x match { + // case b: BreakImpl => b.break + // case b => -1 + // } + def f4(x: Any) = x match { + case BreakImpl(x) => x + case _ => -1 + } + + def main(args: Array[String]) { + val break = BreakImpl(22) + // assert(f1(break) == 22) + assert(f2(break) == 22) + // assert(f3(break) == 22) + assert(f4(break) == 22) + } +} + |