Skip to content

Commit 6b70f91

Browse files
Scoverage & CC interaction: exempt CC nested symbols from @experimental check (#25687)
Capture checking introduces some `experimental` symbols that are exempt from experimental checks with capture checking enabled. Currently, exemptions are only applied to the symbol itself, not its owner. Coverage instrumentation introduces synthetic `ValDef`s which may expose capture checking symbols owned by experimental classes to experimental checks, bypassing the exemption. This PR hardens the exemption to apply check the owner of the symbol as well. ## How much have you relied on LLM-based tools in this contribution? Moderately. ## How was the solution tested? - Reproduced the two failing tests individually with coverage before the fix - Re-ran the same two tests with coverage after the fix and confirmed they pass - Ran positive & coverage compilation suites with the fix introduced
1 parent 88140bc commit 6b70f91

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

compiler/src/dotty/tools/dotc/config/Feature.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ object Feature:
212212
report.error(experimentalUseSite(which) + note, srcPos)
213213

214214
private def ccException(sym: Symbol)(using Context): Boolean =
215-
ccEnabled && defn.ccExperimental.contains(sym)
215+
ccEnabled && (defn.ccExperimental.contains(sym)
216+
|| sym.exists && defn.ccExperimental.contains(sym.owner))
216217

217218
def checkExperimentalDef(sym: Symbol, srcPos: SrcPos)(using Context) =
218219
val experimentalSym =

compiler/test/dotc/scoverage-ignore.excludelist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ i18589
2525
i19955a.scala
2626
i19955b.scala
2727
i20053b.scala
28-
i21313.scala
2928
i2146.scala
3029
i23179.scala
3130
i23489.scala
32-
i24039.scala
3331
i5039.scala
3432
i8623.scala
3533
i8900a3.scala

0 commit comments

Comments
 (0)