Skip to content

Commit a163f0c

Browse files
committed
Report illegal capture reference only once
If we do not strip the capture set at this point, then the type will be transformed twice and we'll get the same error message twice.
1 parent cf66d18 commit a163f0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
328328
CapturingType(parent2, ann.tree.toCaptureSet)
329329
catch case ex: IllegalCaptureRef =>
330330
report.error(em"Illegal capture reference: ${ex.getMessage.nn}", tptToCheck.fold(NoSourcePosition)(_.srcPos))
331-
t
331+
parent2
332332
else
333333
t.derivedAnnotatedType(parent1, ann)
334334
case throwsAlias(res, exc) =>

0 commit comments

Comments
 (0)