Skip to content

Commit 8c2b6bf

Browse files
committed
Also print boxes for variable capture sets with no elems defined
1 parent e08a59f commit 8c2b6bf

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
208208
else if ctx.settings.YccDebug.value then
209209
changePrec(GlobalPrec)(box ~ refs.show ~ " " ~ toText(parent))
210210
else if !refs.isConst && refs.elems.isEmpty then
211-
changePrec(GlobalPrec)("?" ~ " " ~ toText(parent))
211+
changePrec(GlobalPrec)(box ~ "?" ~ " " ~ toText(parent))
212212
else if Config.printCaptureSetsAsPrefix then
213213
changePrec(GlobalPrec)(box ~ toText(refs) ~ " " ~ toText(parent))
214214
else
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/boxmap.scala:12:2 ----------------------------------------
22
12 | () => b[Box[B]]((x: A) => box(f(x))) // error
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| Found: {f} () -> ? Box[? B]
4+
| Found: {f} () -> ? Box[box ? B]
55
| Required: () -> Box[B]
66
|
77
| longer explanation available when compiling with `-explain`

tests/neg-custom-args/captures/lazylist.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
17 | def tail = xs() // error: cannot have an inferred type
3838
| ^^^^^^^^^^^^^^^
3939
| Non-local method tail cannot have an inferred result type
40-
| {LazyCons.this.xs} lazylists.LazyList[? T]
40+
| {LazyCons.this.xs} lazylists.LazyList[box ? T]
4141
| with non-empty capture set {LazyCons.this.xs}.
4242
| The type needs to be declared explicitly.

tests/neg-custom-args/captures/lazylists2.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazylists2.scala:18:4 ------------------------------------
99
18 | final class Mapped extends LazyList[B]: // error
1010
| ^
11-
| Found: {f, xs} LazyList[? B]
11+
| Found: {f, xs} LazyList[box ? B]
1212
| Required: {f} LazyList[B]
1313
19 | this: ({xs, f} Mapped) =>
1414
20 | def isEmpty = false
@@ -20,7 +20,7 @@
2020
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazylists2.scala:27:4 ------------------------------------
2121
27 | final class Mapped extends LazyList[B]: // error
2222
| ^
23-
| Found: {f, xs} LazyList[? B]
23+
| Found: {f, xs} LazyList[box ? B]
2424
| Required: {xs} LazyList[B]
2525
28 | this: ({xs, f} Mapped) =>
2626
29 | def isEmpty = false

0 commit comments

Comments
 (0)