diff options
author | Paul Phillips <paulp@improving.org> | 2013-08-17 08:57:53 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-08-17 10:58:13 -0700 |
commit | 35775a8fc87e9f3538e13e8d26f9b151138efe8c (patch) | |
tree | a1df773f6a75d87feb6913890fdfb6be42cf90bf /test/files/neg/t4425b.check | |
parent | e611eeaf4573db8ec16a38cb00705391496ebe0e (diff) | |
download | scala-35775a8fc87e9f3538e13e8d26f9b151138efe8c.tar.gz scala-35775a8fc87e9f3538e13e8d26f9b151138efe8c.tar.bz2 scala-35775a8fc87e9f3538e13e8d26f9b151138efe8c.zip |
SI-4425 do some validity checking on unapplies.
Filter out unapplies which can't be called (such as those with
a second non-implicit parameter list) and report the error in a
meaningful fashion.
Diffstat (limited to 'test/files/neg/t4425b.check')
-rw-r--r-- | test/files/neg/t4425b.check | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/files/neg/t4425b.check b/test/files/neg/t4425b.check new file mode 100644 index 0000000000..e43c489586 --- /dev/null +++ b/test/files/neg/t4425b.check @@ -0,0 +1,55 @@ +t4425b.scala:5: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println( "" match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:6: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:7: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println( "" match { case X(_) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:8: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println((X: Any) match { case X(_) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:9: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:10: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list + println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:18: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println( "" match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:19: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:20: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println( "" match { case X(_) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:21: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println((X: Any) match { case X(_) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:22: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:23: error: result type Nothing of unapply defined in method unapply in object X does not conform to Option[_] or Boolean + println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:31: error: wrong number of arguments for object X + println( "" match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:32: error: wrong number of arguments for object X + println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:35: error: wrong number of arguments for object X + println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +t4425b.scala:36: error: wrong number of arguments for object X + println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) + ^ +16 errors found |