Skip to content

Commit 064b137

Browse files
szymon-rdKordyjan
authored andcommitted
Warn for synthetic using/givens with wunused
1 parent 46acdfd commit 064b137

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ object CheckUnused:
471471
if ctx.settings.WunusedHas.implicits then
472472
implicitParamInScope
473473
.filterNot(d => d.symbol.usedDefContains)
474-
.filterNot(d => containsSyntheticSuffix(d.symbol))
474+
.filterNot(d => containsSyntheticSuffix(d.symbol) && !d.rawMods.is(Given))
475475
.map(d => d.namePos -> WarnTypes.ImplicitParams).toList
476476
else
477477
Nil

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ val default_int = 1
55

66
def f1(a: Int) = a // OK
77
def f2(a: Int) = 1 // OK
8-
def f3(a: Int)(using Int) = a // OK
8+
def f3(a: Int)(using Int) = a // error
99
def f4(a: Int)(using Int) = default_int // error
1010
def f6(a: Int)(using Int) = summon[Int] // OK
1111
def f7(a: Int)(using Int) = summon[Int] + a // OK

0 commit comments

Comments
 (0)