diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-07-13 08:05:04 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-07-13 08:05:04 +0000 |
commit | 8a0d130537be8c3716ab9191d84c53d39aaa1804 (patch) | |
tree | 8517ab3b5e82f4bb681f048e702b96f8e9d2d0fc /test/files/neg/t0816.scala | |
parent | 038fef39ad4310fc3fe1c5324b004e42fd0036b3 (diff) | |
download | scala-8a0d130537be8c3716ab9191d84c53d39aaa1804.tar.gz scala-8a0d130537be8c3716ab9191d84c53d39aaa1804.tar.bz2 scala-8a0d130537be8c3716ab9191d84c53d39aaa1804.zip |
prohibit case-to-case inheritance instead of is...
prohibit case-to-case inheritance instead of issuing warning. closes
#4109. review by extempore, since it should make your life much easier
in the pattern matcher
Diffstat (limited to 'test/files/neg/t0816.scala')
-rw-r--r-- | test/files/neg/t0816.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/neg/t0816.scala b/test/files/neg/t0816.scala new file mode 100644 index 0000000000..0128a0ad72 --- /dev/null +++ b/test/files/neg/t0816.scala @@ -0,0 +1,12 @@ +abstract class Atest(val data: String) + +case class Btest(override val data: String, val b: Boolean) extends Atest(data) + +case class Ctest(override val data: String) extends Btest(data, true) + +class testCaseClass { + def test(x: Atest) = x match { + case Ctest(data) => Console.println("C") + case Btest(data, b) => Console.println("B") + } +} |