Skip to content

Commit b3eeb23

Browse files
committed
Don't box arguments of inferred applied types at Setup
Rely on auto-boxing when accessing the arguments instead
1 parent aeafb05 commit b3eeb23

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ extends tpd.TreeTraverser:
209209
else
210210
tp.derivedAppliedType(tycon1, args1 :+ res1)
211211
else
212-
tp.derivedAppliedType(tycon1, args.mapConserve(arg => box(this(arg))))
212+
tp.derivedAppliedType(tycon1, args.mapConserve(arg => this(arg)))
213213
case tp @ RefinedType(core, rname, rinfo) if defn.isFunctionType(tp) =>
214214
val rinfo1 = apply(rinfo)
215215
if rinfo1 ne rinfo then rinfo1.toFunctionType(isJava = false, alwaysDependent = true)

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[box ? T]
40+
| {LazyCons.this.xs} lazylists.LazyList[? 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[box ? B]
11+
| Found: {f, xs} LazyList[? 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[box ? B]
23+
| Found: {f, xs} LazyList[? B]
2424
| Required: {xs} LazyList[B]
2525
28 | this: ({xs, f} Mapped) =>
2626
29 | def isEmpty = false

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:23:49 ------------------------------------------
22
23 | val a = handle[Exception, CanThrow[Exception]] { // error
33
| ^
4-
| Found: ? ({*} CT[Exception]) -> {*} CT[? >: box ? Exception <: box ? Exception]
5-
| Required: CanThrow[Exception] => box {*} CT[Exception]
4+
| Found: ? ({*} CT[Exception]) -> {*} CT[? >: ? Exception <: ? Exception]
5+
| Required: CanThrow[Exception] => box {*} CT[Exception]
66
24 | (x: CanThrow[Exception]) => x
77
25 | }{
88
|

0 commit comments

Comments
 (0)