Skip to content

Commit

Permalink
Report illegal capture reference only once
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bracevac committed Nov 21, 2024
1 parent cf66d18 commit a163f0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
CapturingType(parent2, ann.tree.toCaptureSet)
catch case ex: IllegalCaptureRef =>
report.error(em"Illegal capture reference: ${ex.getMessage.nn}", tptToCheck.fold(NoSourcePosition)(_.srcPos))
t
parent2
else
t.derivedAnnotatedType(parent1, ann)
case throwsAlias(res, exc) =>
Expand Down

0 comments on commit a163f0c

Please sign in to comment.