From 81a4d20bf38e5348e5b1b2faa0fcedafa458aca3 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 2 Jul 2007 12:01:28 +0000 Subject: fixed bug1183 --- test/files/neg/bug1183.check | 17 +++++++++++++++++ test/files/neg/bug1183.scala | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/files/neg/bug1183.check create mode 100644 test/files/neg/bug1183.scala (limited to 'test/files/neg') diff --git a/test/files/neg/bug1183.check b/test/files/neg/bug1183.check new file mode 100644 index 0000000000..9b42dccb8d --- /dev/null +++ b/test/files/neg/bug1183.check @@ -0,0 +1,17 @@ +bug1183.scala:10: error: name clash: class Foo defines object Baz + and its companion module object Foo defines class Baz + object Baz + ^ +bug1183.scala:11: error: name clash: class Foo defines class Bam + and its companion module object Foo defines object Bam + class Bam + ^ +bug1183.scala:12: error: name clash: class Foo defines object Bar + and its companion module object Foo defines class Bar + object Bar + ^ +bug1183.scala:13: error: name clash: class Foo defines class Bar + and its companion module object Foo defines class Bar + case class Bar(i:Int) + ^ +four errors found diff --git a/test/files/neg/bug1183.scala b/test/files/neg/bug1183.scala new file mode 100644 index 0000000000..a845126488 --- /dev/null +++ b/test/files/neg/bug1183.scala @@ -0,0 +1,38 @@ +import scala.testing.SUnit._ + +object Test extends TestConsoleMain { + + def suite = new TestSuite( + new Test717 + ) + + class Foo(j:Int) { + object Baz + class Bam + object Bar + case class Bar(i:Int) + } + + + class Test717 extends TestCase("#717 test path of case classes") { + val foo1 = new Foo(1) + + override def runTest() = { + val res = (foo1.Bar(2):Any) match { + case foo1.Bar(2) => true // (1) + } + assertTrue("ok", res); + } + } + + // (2) + object Foo { + class Bar(val x : String) + class Baz + object Bam + object Bar + + def unapply(s : String) : Option[Bar] = Some(new Bar(s)) + } + +} -- cgit v1.2.3