diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 30d35b7ac00a..8542caa8e637 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -229,7 +229,7 @@ class PlainPrinter(_ctx: Context) extends Printer { }.close def toTextSingleton(tp: SingletonType): Text = - toTextLocal(tp.underlying) ~ "(" ~ toTextRef(tp) ~ ")" + "(" ~ toTextRef(tp) ~ " : " ~ toTextGlobal(tp.underlying) ~ ")" protected def paramsText(tp: LambdaType): Text = { def paramText(name: Name, tp: Type) = toText(name) ~ toTextRHS(tp) diff --git a/compiler/test-resources/repl/errmsgs b/compiler/test-resources/repl/errmsgs index f4d4d0bac1b1..e4cb6eca36d4 100644 --- a/compiler/test-resources/repl/errmsgs +++ b/compiler/test-resources/repl/errmsgs @@ -3,22 +3,22 @@ scala> class Inv[T](x: T) scala> val x: List[String] = List(1) 1 | val x: List[String] = List(1) | ^ - | Found: Int(1) + | Found: (1 : Int) | Required: String scala> val y: List[List[String]] = List(List(1)) 1 | val y: List[List[String]] = List(List(1)) | ^ - | Found: Int(1) + | Found: (1 : Int) | Required: String scala> val z: (List[String], List[Int]) = (List(1), List("a")) 1 | val z: (List[String], List[Int]) = (List(1), List("a")) | ^ - | Found: Int(1) + | Found: (1 : Int) | Required: String 1 | val z: (List[String], List[Int]) = (List(1), List("a")) | ^^^ - | Found: String("a") - | Required: Int + | Found: ("a" : String) + | Required: Int scala> val a: Inv[String] = new Inv(new Inv(1)) 1 | val a: Inv[String] = new Inv(new Inv(1)) | ^^^^^^^^^^ @@ -27,19 +27,19 @@ scala> val a: Inv[String] = new Inv(new Inv(1)) scala> val b: Inv[String] = new Inv(1) 1 | val b: Inv[String] = new Inv(1) | ^ - | Found: Int(1) + | Found: (1 : Int) | Required: String scala> abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } 1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } | ^ - |Found: C.this.T(C.this.x) + |Found: (C.this.x : C.this.T) |Required: T² | |where: T is a type in class C | T² is a type in the initializer of value s which is an alias of String 1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } | ^ - |Found: T(y) + |Found: (y : T) |Required: T² | |where: T is a type in the initializer of value s which is an alias of String @@ -51,7 +51,7 @@ scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr scala> val x: List[Int] = "foo" :: List(1) 1 | val x: List[Int] = "foo" :: List(1) | ^^^^^ - | Found: String("foo") + | Found: ("foo" : String) | Required: Int scala> while ((( foo ))) {} 1 | while ((( foo ))) {} diff --git a/compiler/test-resources/repl/importFromObj b/compiler/test-resources/repl/importFromObj index 6dca6bf27462..31753dfbd821 100644 --- a/compiler/test-resources/repl/importFromObj +++ b/compiler/test-resources/repl/importFromObj @@ -7,7 +7,7 @@ scala> import o._ scala> buf += xs 1 | buf += xs | ^^ - | Found: List[Int](o.xs) + | Found: (o.xs : List[Int]) | Required: Int scala> buf ++= xs val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 3) diff --git a/compiler/test-resources/type-printer/type-mismatch b/compiler/test-resources/type-printer/type-mismatch index 0ec5de9c05a7..83a84d917113 100644 --- a/compiler/test-resources/type-printer/type-mismatch +++ b/compiler/test-resources/type-printer/type-mismatch @@ -5,5 +5,5 @@ val res0: Foo[Int] = Foo(1) scala> val x: Foo[String] = res0 1 | val x: Foo[String] = res0 | ^^^^ - | Found: Foo[Int](res0) + | Found: (res0 : Foo[Int]) | Required: Foo[String] diff --git a/language-server/test/dotty/tools/languageserver/DiagnosticsTest.scala b/language-server/test/dotty/tools/languageserver/DiagnosticsTest.scala index d80b22253345..bc0fe6cb38d3 100644 --- a/language-server/test/dotty/tools/languageserver/DiagnosticsTest.scala +++ b/language-server/test/dotty/tools/languageserver/DiagnosticsTest.scala @@ -12,7 +12,7 @@ class DiagnosticsTest { | val x: Int = $m1"foo"$m2 |}""".withSource .diagnostics(m1, - (m1 to m2, """Found: String("foo") + (m1 to m2, """Found: ("foo" : String) |Required: Int""".stripMargin, Error, Some(TypeMismatchID)) ) diff --git a/language-server/test/dotty/tools/languageserver/HoverTest.scala b/language-server/test/dotty/tools/languageserver/HoverTest.scala index a753f4ed4901..84652af55efc 100644 --- a/language-server/test/dotty/tools/languageserver/HoverTest.scala +++ b/language-server/test/dotty/tools/languageserver/HoverTest.scala @@ -46,7 +46,7 @@ class HoverTest { | ${m1}val x = ${m2}8$m3; ${m4}x$m5 |}""".withSource .hover(m1 to m2, hoverContent("Int")) - .hover(m2 to m3, hoverContent("Int(8)")) + .hover(m2 to m3, hoverContent("(8 : Int)")) .hover(m4 to m5, hoverContent("Int")) } @@ -54,8 +54,8 @@ class HoverTest { code"""class Foo { | ${m1}final val x = 8$m2; ${m3}x$m4 |}""".withSource - .hover(m1 to m2, hoverContent("Int(8)")) - .hover(m3 to m4, hoverContent("Int(8)")) + .hover(m1 to m2, hoverContent("(8 : Int)")) + .hover(m3 to m4, hoverContent("(8 : Int)")) } @Test def hoverOnDefDef0: Unit = { @@ -63,7 +63,7 @@ class HoverTest { | ${m1}def x = ${m2}8$m3; ${m4}x$m5 |}""".withSource .hover(m1 to m2, hoverContent("Int")) - .hover(m2 to m3, hoverContent("Int(8)")) + .hover(m2 to m3, hoverContent("(8 : Int)")) .hover(m4 to m5, hoverContent("Int")) } @@ -83,7 +83,7 @@ class HoverTest { | ${m5}y($m6)$m7 |} """.withSource - .hover(m1 to m2, hoverContent("String(\"abc\")" )) + .hover(m1 to m2, hoverContent("(\"abc\" : String)")) .hover(m3 to m4, hoverContent("String")) .hover(m5 to m6, hoverContent("(): Int")) .hover(m6 to m7, hoverContent("Int")) @@ -185,8 +185,8 @@ class HoverTest { |class annot4 extends scala.annotation.Annotation |class annot5 extends scala.annotation.Annotation |""".withSource - .hover(m1 to m2, hoverContent("Int(1)")) - .hover(m3 to m4, hoverContent("Int(1) @annot1 @annot2 @annot3 @annot4 @annot5")) + .hover(m1 to m2, hoverContent("(1 : Int)")) + .hover(m3 to m4, hoverContent("(1 : Int) @annot1 @annot2 @annot3 @annot4 @annot5")) } @Test def unicodeChar: Unit = { @@ -207,6 +207,6 @@ class HoverTest { |val y = ${m1}this${m2}.x""".withSource // The test framework will place the code above in a virtual file called Source0.scala, // sp the top-level definitions should be enclosed in an object called `Source0$package`. - .hover(m1 to m2, hoverContent("hello.Source0$package.type(hello.Source0$package)")) + .hover(m1 to m2, hoverContent("(hello.Source0$package : hello.Source0$package.type)")) } } diff --git a/tests/neg/cannot-reduce-inline-match.check b/tests/neg/cannot-reduce-inline-match.check index f66966096118..bd5992761893 100644 --- a/tests/neg/cannot-reduce-inline-match.check +++ b/tests/neg/cannot-reduce-inline-match.check @@ -4,6 +4,6 @@ | cannot reduce inline match with | scrutinee: { | "f" - | } : String("f") + | } : ("f" : String) | patterns : case _:Int | This location contains code that was inlined from cannot-reduce-inline-match.scala:3 diff --git a/tests/neg/exports.check b/tests/neg/exports.check index dc223d9b2fa1..c6cbb43106ce 100644 --- a/tests/neg/exports.check +++ b/tests/neg/exports.check @@ -52,4 +52,4 @@ | ^ | Double definition: | val bar: Bar in class Baz at line 45 and - | final def bar: => => Bar(Baz.this.bar.baz.bar)(Baz.this.bar.bar) in class Baz at line 46 + | final def bar: => (Baz.this.bar.bar : => (Baz.this.bar.baz.bar : Bar)) in class Baz at line 46 diff --git a/tests/neg/inline-error-pos.check b/tests/neg/inline-error-pos.check index 4c92d7ef3ce4..b529a888f33b 100644 --- a/tests/neg/inline-error-pos.check +++ b/tests/neg/inline-error-pos.check @@ -4,6 +4,6 @@ | cannot reduce inline match with | scrutinee: { | 2 - | } : Int(2) + | } : (2 : Int) | patterns : case 1 | This location contains code that was inlined from inline-error-pos.scala:3