Skip to content

Improve Inlined printing #9794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case tree @ Inlined(call, bindings, body) =>
(("/* inlined from " ~ (if (call.isEmpty) "outside" else toText(call)) ~ " */ ") `provided`
!homogenizedView && ctx.settings.XprintInline.value) ~
blockText(bindings :+ body)
(if bindings.isEmpty then toText(body) else blockText(bindings :+ body))
case tpt: untpd.DerivedTypeTree =>
"<derived typetree watching " ~ tpt.watched.showSummary() ~ ">"
case TypeTree() =>
Expand Down
4 changes: 1 addition & 3 deletions tests/neg/cannot-reduce-inline-match.check
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
9 | foo("f") // error
| ^^^^^^^^
| cannot reduce inline match with
| scrutinee: {
| "f"
| } : ("f" : String)
| scrutinee: "f" : ("f" : String)
| patterns : case _:Int
| This location contains code that was inlined from cannot-reduce-inline-match.scala:3
4 changes: 1 addition & 3 deletions tests/neg/inline-error-pos.check
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
8 | val b = foo(2) // error
| ^^^^^^
| cannot reduce inline match with
| scrutinee: {
| 2
| } : (2 : Int)
| scrutinee: 2 : (2 : Int)
| patterns : case 1
| This location contains code that was inlined from inline-error-pos.scala:3