Skip to content

Commit 62ec194

Browse files
authored
Merge pull request #9794 from dotty-staging/improve-inlined-node-printing
Improve Inlined printing
2 parents cbb05c8 + f349862 commit 62ec194

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
463463
case tree @ Inlined(call, bindings, body) =>
464464
(("/* inlined from " ~ (if (call.isEmpty) "outside" else toText(call)) ~ " */ ") `provided`
465465
!homogenizedView && ctx.settings.XprintInline.value) ~
466-
blockText(bindings :+ body)
466+
(if bindings.isEmpty then toText(body) else blockText(bindings :+ body))
467467
case tpt: untpd.DerivedTypeTree =>
468468
"<derived typetree watching " ~ tpt.watched.showSummary() ~ ">"
469469
case TypeTree() =>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
9 | foo("f") // error
33
| ^^^^^^^^
44
| cannot reduce inline match with
5-
| scrutinee: {
6-
| "f"
7-
| } : ("f" : String)
5+
| scrutinee: "f" : ("f" : String)
86
| patterns : case _:Int
97
| This location contains code that was inlined from cannot-reduce-inline-match.scala:3

tests/neg/inline-error-pos.check

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
8 | val b = foo(2) // error
33
| ^^^^^^
44
| cannot reduce inline match with
5-
| scrutinee: {
6-
| 2
7-
| } : (2 : Int)
5+
| scrutinee: 2 : (2 : Int)
86
| patterns : case 1
97
| This location contains code that was inlined from inline-error-pos.scala:3

0 commit comments

Comments
 (0)