From 90956fe63123c14bf950f335596a8baa750d708e Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Tue, 27 Feb 2024 11:15:01 +0100 Subject: [PATCH] Apply review suggestions to coverage filter checking [Cherry-picked 641f5db8383a8570748d916ea82f76fcc136aaf5] --- .../src/dotty/tools/dotc/transform/InstrumentCoverage.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala index a39a1c6f591e..a76919e47164 100644 --- a/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala +++ b/compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala @@ -69,13 +69,15 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer: Serializer.serialize(coverage, outputPath, ctx.settings.sourceroot.value) private def isClassIncluded(sym: Symbol)(using Context): Boolean = + val fqn = sym.fullName.toText(ctx.printerFn(ctx)).show coverageExcludeClasslikePatterns.isEmpty || !coverageExcludeClasslikePatterns.exists( - _.matcher(sym.fullName.toText(ctx.printerFn(ctx)).show).nn.matches + _.matcher(fqn).nn.matches ) private def isFileIncluded(file: SourceFile)(using Context): Boolean = + val normalizedPath = file.path.replace(".scala", "") coverageExcludeFilePatterns.isEmpty || !coverageExcludeFilePatterns.exists( - _.matcher(file.path.replace(".scala", "")).nn.matches + _.matcher(normalizedPath).nn.matches ) override protected def newTransformer(using Context) =