aboutsummaryrefslogtreecommitdiff
path: root/tests/run/t5407.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/t5407.scala')
-rw-r--r--tests/run/t5407.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/run/t5407.scala b/tests/run/t5407.scala
new file mode 100644
index 000000000..cc761e5c0
--- /dev/null
+++ b/tests/run/t5407.scala
@@ -0,0 +1,17 @@
+case class Foo(private val x: Int, y: Option[Int], z: Boolean)
+
+object Test extends dotty.runtime.LegacyApp {
+ def foo(x: Foo) = x match {
+ case Foo(x, Some(y), z) => y
+ case Foo(x, y, z) => 0
+ }
+ val x = Foo(1, Some(2), false)
+ println(foo(x))
+
+
+ def bar(x: Foo) = x match {
+ case Foo(x, Some(y), z) => y
+ case Foo(x, None, z) => 0
+ }
+ println(bar(x))
+}