File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
compiler/src/dotty/tools/dotc/cc
tests/pos-custom-args/captures Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,16 @@ extension (tp: Type)
9696 /** Is the boxedCaptureSet of this type nonempty? */
9797 def isBoxedCapturing (using Context ) = ! tp.boxedCaptureSet.isAlwaysEmpty
9898
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
101104 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 )
103109 case _ =>
104110 tp
105111
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ type ErrorHandler = (Int, String) => Unit
33
44var defaultIncompleteHandler : ErrorHandler = ???
55var 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