diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2012-11-05 12:52:56 -0500 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2012-11-05 12:52:56 -0500 |
commit | aedc853040d7774bd39df43a51715f674f99471e (patch) | |
tree | 3d9fad1100c241b8663703898e46c030698eafe7 /test/files/neg | |
parent | 999918311b7bf764916431485cb11043f1c220ed (diff) | |
parent | 8b598436f64ca4e980c8a38f642085b4d23e2327 (diff) | |
download | scala-aedc853040d7774bd39df43a51715f674f99471e.tar.gz scala-aedc853040d7774bd39df43a51715f674f99471e.tar.bz2 scala-aedc853040d7774bd39df43a51715f674f99471e.zip |
Merge branch '2.10.0-wip' into merge-2.10.0
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t6534.check | 17 | ||||
-rw-r--r-- | test/files/neg/t6534.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t6534.scala | 10 |
3 files changed, 28 insertions, 0 deletions
diff --git a/test/files/neg/t6534.check b/test/files/neg/t6534.check new file mode 100644 index 0000000000..52e70cfa8a --- /dev/null +++ b/test/files/neg/t6534.check @@ -0,0 +1,17 @@ +t6534.scala:4: warning: Implementation of equals inherited from trait Foo overridden in class Bippy1 to enforce value class semantics +class Bippy1(val x: Int) extends AnyVal with Foo { } // warn + ^ +t6534.scala:5: warning: Implementation of hashCode inherited from trait Ding overridden in class Bippy2 to enforce value class semantics +class Bippy2(val x: Int) extends AnyVal with Ding { } // warn + ^ +t6534.scala:6: error: redefinition of equals method. See SIP-15, criterion 4. is not allowed in value class +class Bippy3(val x: Int) extends AnyVal { override def equals(x: Any) = false } // error + ^ +t6534.scala:7: error: redefinition of hashCode method. See SIP-15, criterion 4. is not allowed in value class +class Bippy4(val x: Int) extends AnyVal { override def hashCode = -1 } // error + ^ +t6534.scala:9: error: redefinition of equals method. See SIP-15, criterion 4. is not allowed in value class +case class Bippy6(val x: Int) extends AnyVal { override def productPrefix = "Dingo" ; override def equals(x: Any) = false } // error + ^ +two warnings found +three errors found diff --git a/test/files/neg/t6534.flags b/test/files/neg/t6534.flags new file mode 100644 index 0000000000..1008b0a70c --- /dev/null +++ b/test/files/neg/t6534.flags @@ -0,0 +1 @@ +-Xlint diff --git a/test/files/neg/t6534.scala b/test/files/neg/t6534.scala new file mode 100644 index 0000000000..de588b69a7 --- /dev/null +++ b/test/files/neg/t6534.scala @@ -0,0 +1,10 @@ +trait Foo extends Any { override def equals(x: Any) = false } +trait Ding extends Any { override def hashCode = -1 } + +class Bippy1(val x: Int) extends AnyVal with Foo { } // warn +class Bippy2(val x: Int) extends AnyVal with Ding { } // warn +class Bippy3(val x: Int) extends AnyVal { override def equals(x: Any) = false } // error +class Bippy4(val x: Int) extends AnyVal { override def hashCode = -1 } // error +case class Bippy5(val x: Int) extends AnyVal { override def productPrefix = "Dingo" } // nothing +case class Bippy6(val x: Int) extends AnyVal { override def productPrefix = "Dingo" ; override def equals(x: Any) = false } // error + |