File tree 2 files changed +12
-6
lines changed
compiler/src/dotty/tools/dotc/cc
tests/pos-custom-args/captures
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,16 @@ extension (tp: Type)
96
96
/** Is the boxedCaptureSet of this type nonempty? */
97
97
def isBoxedCapturing (using Context ) = ! tp.boxedCaptureSet.isAlwaysEmpty
98
98
99
- /** If this type is a boxed capturing type, its unboxed version */
100
- def unbox (using Context ): Type = tp match
99
+ /** If this type is a boxed capturing type, its unboxed version
100
+ * If it is a TermRef of boxed capturing type, an unboxed capturing
101
+ * type capturing the TermRef.
102
+ */
103
+ def unbox (using Context ): Type = tp.widenDealias match
101
104
case tp @ CapturingType (parent, refs) if tp.isBoxed =>
102
- CapturingType (parent, refs, boxed = false )
105
+ val refs1 = tp match
106
+ case ref : CaptureRef if ref.isTracked => ref.singletonCaptureSet
107
+ case _ => refs
108
+ CapturingType (parent, refs1, boxed = false )
103
109
case _ =>
104
110
tp
105
111
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ type ErrorHandler = (Int, String) => Unit
3
3
4
4
var defaultIncompleteHandler : ErrorHandler = ???
5
5
var incompleteHandler : ErrorHandler = defaultIncompleteHandler
6
- // val x = incompleteHandler.unsafeUnbox
7
-
8
-
6
+ val x = incompleteHandler.unsafeUnbox
7
+ val _ : ErrorHandler = x
8
+ val _ = x( 1 , " a " )
You can’t perform that action at this time.
0 commit comments