From cbe2ab26d3b507a33f1b910a803878d78f751f74 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Fri, 14 Oct 2016 12:01:13 +0200 Subject: fix #1540: overloaded get and isDefined in option-less patmat --- tests/pos/i1540.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/pos/i1540.scala (limited to 'tests/pos/i1540.scala') diff --git a/tests/pos/i1540.scala b/tests/pos/i1540.scala new file mode 100644 index 000000000..7aa24f459 --- /dev/null +++ b/tests/pos/i1540.scala @@ -0,0 +1,14 @@ +class Casey1(val a: Int) { + def isDefined: Boolean = true + def isDefined(x: Int): Boolean = ??? + def get: Int = a + def get(x: Int): String = ??? +} +object Casey1 { def unapply(a: Casey1) = a } + +object Test { + def main(args: Array[String]): Unit = { + val c @ Casey1(x) = new Casey1(0) + assert(x == c.get) + } +} -- cgit v1.2.3