Skip to content

Commit 46c0759

Browse files
committed
Fix #7634: Use (x: C) instead of C(x) for printing singleton types
1 parent 77ca516 commit 46c0759

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
229229
}.close
230230

231231
def toTextSingleton(tp: SingletonType): Text =
232-
toTextLocal(tp.underlying) ~ "(" ~ toTextRef(tp) ~ ")"
232+
"(" ~ toTextRef(tp) ~ " : " ~ toTextGlobal(tp.underlying) ~ ")"
233233

234234
protected def paramsText(tp: LambdaType): Text = {
235235
def paramText(name: Name, tp: Type) = toText(name) ~ toTextRHS(tp)

tests/neg/cannot-reduce-inline-match.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
| cannot reduce inline match with
55
| scrutinee: {
66
| "f"
7-
| } : String("f")
7+
| } : ("f" : String)
88
| patterns : case _:Int
99
| This location contains code that was inlined from cannot-reduce-inline-match.scala:3

tests/neg/exports.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@
5252
| ^
5353
| Double definition:
5454
| val bar: Bar in class Baz at line 45 and
55-
| final def bar: => => Bar(Baz.this.bar.baz.bar)(Baz.this.bar.bar) in class Baz at line 46
55+
| final def bar: => (Baz.this.bar.bar : => (Baz.this.bar.baz.bar : Bar)) in class Baz at line 46

tests/neg/inline-error-pos.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
| cannot reduce inline match with
55
| scrutinee: {
66
| 2
7-
| } : Int(2)
7+
| } : (2 : Int)
88
| patterns : case 1
99
| This location contains code that was inlined from inline-error-pos.scala:3

0 commit comments

Comments
 (0)