From f0fb641bf6771b2050b08a7533d4aecf8b15dc72 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 23 Mar 2007 13:17:26 +0000 Subject: fixed bug1011 --- test/files/neg/bug839.check | 2 +- test/files/neg/checksensible.check | 11 ++++++++++- test/files/neg/checksensible.scala | 5 +++++ test/files/pos/bug1010.scala | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 test/files/pos/bug1010.scala (limited to 'test') diff --git a/test/files/neg/bug839.check b/test/files/neg/bug839.check index 281254ea00..ec5206effa 100644 --- a/test/files/neg/bug839.check +++ b/test/files/neg/bug839.check @@ -1,5 +1,5 @@ bug839.scala:25: error: method set cannot be accessed in object Test.this.FileImpl#treeBuilder - because its instance type (Test.this.FileImpl#treeBuilder#global.Tree)scala.Unit contains a malformed type: object Test.this.FileImpl#treeBuilder#global + because its instance type (Test.this.Global#Tree)scala.Unit contains a malformed type: Test.this.Global#Tree file.treeBuilder.set(nsc.get); ^ one error found diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index 6ca462b528..442780f55c 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -31,5 +31,14 @@ checksensible.scala:16: warning: comparing values of types scala.Int and scala.N checksensible.scala:26: warning: comparing values of types scala.Unit and scala.Int using `!=' will always yield true while((c = in.read) != -1) { ^ -10 warnings found +checksensible.scala:33: warning: comparing values of types scala.Unit and scala.Boolean using `==' will always yield false + println({} == true) + ^ +checksensible.scala:35: warning: comparing a fresh object using `==' will always yield false + println(new Object == 1) + ^ +checksensible.scala:36: warning: comparing values of types scala.Int and java.lang.Object using `==' will always yield false + println(1 == (new Object)) + ^ +13 warnings found one error found diff --git a/test/files/neg/checksensible.scala b/test/files/neg/checksensible.scala index fa2655a241..7d0514396d 100644 --- a/test/files/neg/checksensible.scala +++ b/test/files/neg/checksensible.scala @@ -30,6 +30,11 @@ class Test { in.close } + println({} == true) + println("hello" == 2) + println(new Object == 1) + println(1 == (new Object)) + def isabstract: int } diff --git a/test/files/pos/bug1010.scala b/test/files/pos/bug1010.scala new file mode 100644 index 0000000000..7a1e6615e5 --- /dev/null +++ b/test/files/pos/bug1010.scala @@ -0,0 +1,15 @@ +class MailBox { + class Message + //type Message = AnyRef +} + +abstract class Actor { + private val in = new MailBox + + def send(msg: in.Message) = error("foo") + + def unstable: Actor = error("foo") + + def dubiousSend(msg: MailBox#Message): Nothing = + unstable.send(msg) // in.Message becomes unstable.Message, but that's ok since Message is a concrete type member +} -- cgit v1.2.3