aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-10-14 22:47:55 +0200
committerGitHub <noreply@github.com>2016-10-14 22:47:55 +0200
commit5ebd55243ccc5ca637aa8c32f085a3ffb0fd93cb (patch)
tree03130cce971f54b5afd3a2404468d32f6691712b /tests/pos
parentc5aa4ec052cae047486cffe7495d0bc02c103357 (diff)
parenteca3f6997e324559aa499cced51a275fe118051f (diff)
downloaddotty-5ebd55243ccc5ca637aa8c32f085a3ffb0fd93cb.tar.gz
dotty-5ebd55243ccc5ca637aa8c32f085a3ffb0fd93cb.tar.bz2
dotty-5ebd55243ccc5ca637aa8c32f085a3ffb0fd93cb.zip
Merge pull request #1597 from dotty-staging/fix-i1540
Fix #1540: overloaded get and isDefined in option-less patmat
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/i1540.scala14
-rw-r--r--tests/pos/i1540b.scala14
2 files changed, 28 insertions, 0 deletions
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)
+ }
+}
diff --git a/tests/pos/i1540b.scala b/tests/pos/i1540b.scala
new file mode 100644
index 000000000..2b4c5408e
--- /dev/null
+++ b/tests/pos/i1540b.scala
@@ -0,0 +1,14 @@
+class Casey1[T](val a: T) {
+ def isDefined: Boolean = true
+ def isDefined(x: T): Boolean = ???
+ def get: T = a
+ def get(x: T): String = ???
+}
+object Casey1 { def unapply[T](a: Casey1[T]) = a }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val c @ Casey1(x) = new Casey1(0)
+ assert(x == c.get)
+ }
+}