From cbcf3f505144297ad197d0086ea7a4c4f1fbb598 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 29 Nov 2010 22:20:39 +0000 Subject: "I invite everyone to change this rule, and obs... "I invite everyone to change this rule, and observe what breaks!" This much beloved comment from #1208 has been on my radar for two years. The worm has turned. Closes #1208. The inferred type of an object is now Foo.type instead of "object Foo". What once was this: scala> val x: Map[Int, Singleton] = Map(1 -> None) :5: error: type mismatch; found : (Int, object None) required: (Int, Singleton) Now exudes a pleasing aura of workingness: scala> val x: Map[Int, Singleton] = Map(1 -> None) x: Map[Int,Singleton] = Map(1 -> None) No review. --- test/files/jvm/manifests.check | 2 -- test/files/jvm/manifests.scala | 7 +++++-- test/files/neg/t0226.check | 2 +- test/files/pos/bug1208.scala | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 test/files/pos/bug1208.scala (limited to 'test') diff --git a/test/files/jvm/manifests.check b/test/files/jvm/manifests.check index 69ab066b87..3b8ca5b5b1 100644 --- a/test/files/jvm/manifests.check +++ b/test/files/jvm/manifests.check @@ -23,8 +23,6 @@ x=(1,2), m=scala.Tuple2[Int, Int] x=(abc,xyz), m=scala.Tuple2[java.lang.String, java.lang.String] x=('abc,'xyz), m=scala.Tuple2[scala.Symbol, scala.Symbol] -x=Test$, m=Test$ -x=scala.collection.immutable.List$, m=scala.collection.immutable.List$ x=Foo, m=Foo[Int] x=Foo, m=Foo[scala.collection.immutable.List[Int]] diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests.scala index bb8843f834..3630b79776 100644 --- a/test/files/jvm/manifests.scala +++ b/test/files/jvm/manifests.scala @@ -38,8 +38,11 @@ object Test1 extends TestUtil { print(('abc, 'xyz)) println() - print(Test) - print(List) + // Disabled: should these work? changing the inference for objects from + // "object Test" to "Test.type" drags in a singleton manifest which for + // some reason leads to serialization failure. + // print(Test) + // print(List) println() print(new Foo(2)) diff --git a/test/files/neg/t0226.check b/test/files/neg/t0226.check index af81e41a6a..247f1f2443 100644 --- a/test/files/neg/t0226.check +++ b/test/files/neg/t0226.check @@ -4,7 +4,7 @@ t0226.scala:5: error: not found: type A1 t0226.scala:5: error: not found: type A1 (implicit _1: Foo[List[A1]], _2: Foo[A2]): Foo[Tuple2[List[A1], A2]] = ^ -t0226.scala:8: error: could not find implicit value for parameter rep: Test.this.Foo[((List[Char], Int), (object Nil, Int))] +t0226.scala:8: error: could not find implicit value for parameter rep: Test.this.Foo[((List[Char], Int), (scala.collection.immutable.Nil.type, Int))] foo(((List('b'), 3), (Nil, 4))) ^ three errors found diff --git a/test/files/pos/bug1208.scala b/test/files/pos/bug1208.scala new file mode 100644 index 0000000000..9ac783d39a --- /dev/null +++ b/test/files/pos/bug1208.scala @@ -0,0 +1,4 @@ +object Test { + object Foo + val f: Option[Foo.type] = Some(Foo) +} -- cgit v1.2.3