Skip to content

Commit 5ff49e2

Browse files
committed
Do not strip annotations in deconstructCapturingType
1 parent 176b23c commit 5ff49e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,12 +729,14 @@ class CheckCaptures extends Recheck, SymTransformer:
729729
* reconstructed with the returned function.
730730
*/
731731
def destructCapturingType(tp: Type, reconstruct: Type => Type = x => x): ((Type, CaptureSet, Boolean), Type => Type) =
732-
tp.dealias match
732+
tp.dealiasKeepAnnots match
733733
case tp @ CapturingType(parent, cs) =>
734734
if parent.dealias.isCapturingType then
735735
destructCapturingType(parent, res => reconstruct(tp.derivedCapturingType(res, cs)))
736736
else
737737
((parent, cs, tp.isBoxed), reconstruct)
738+
case AnnotatedType(parent, annot) =>
739+
destructCapturingType(parent, res => reconstruct(AnnotatedType(res, annot)))
738740
case actual =>
739741
val res = if tp.isFromJavaObject then tp else actual
740742
((res, CaptureSet(), false), reconstruct)

0 commit comments

Comments
 (0)