Skip to content

Commit 2a2a111

Browse files
szymon-rdKordyjan
authored andcommitted
Fix WUnused false positive in for
1 parent 79b87a0 commit 2a2a111

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ object CheckUnused:
473473
if ctx.settings.WunusedHas.explicits then
474474
explicitParamInScope
475475
.filterNot(d => d.symbol.usedDefContains)
476+
.filterNot(d => usedInPosition.exists { case (pos, name) => d.span.contains(pos.span) && name == d.symbol.name})
476477
.filterNot(d => containsSyntheticSuffix(d.symbol))
477478
.map(d => d.namePos -> WarnTypes.ExplicitParams).toList
478479
else

tests/neg-custom-args/fatal-warnings/i15503i.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,4 @@ package foo.test.i17117:
300300

301301
val test = t1.test
302302
}
303-
}
303+
}

0 commit comments

Comments
 (0)