Skip to content

Commit f5d9cce

Browse files
KacperFKorbanWojciechMazur
authored andcommitted
Apply review suggestions to coverage filter checking
[Cherry-picked 641f5db]
1 parent 6941812 commit f5d9cce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer:
6969
Serializer.serialize(coverage, outputPath, ctx.settings.sourceroot.value)
7070

7171
private def isClassIncluded(sym: Symbol)(using Context): Boolean =
72+
val fqn = sym.fullName.toText(ctx.printerFn(ctx)).show
7273
coverageExcludeClasslikePatterns.isEmpty || !coverageExcludeClasslikePatterns.exists(
73-
_.matcher(sym.fullName.toText(ctx.printerFn(ctx)).show).nn.matches
74+
_.matcher(fqn).nn.matches
7475
)
7576

7677
private def isFileIncluded(file: SourceFile)(using Context): Boolean =
78+
val normalizedPath = file.path.replace(".scala", "")
7779
coverageExcludeFilePatterns.isEmpty || !coverageExcludeFilePatterns.exists(
78-
_.matcher(file.path.replace(".scala", "")).nn.matches
80+
_.matcher(normalizedPath).nn.matches
7981
)
8082

8183
override protected def newTransformer(using Context) =

0 commit comments

Comments
 (0)