File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -602,15 +602,16 @@ object CheckUnused:
602602 val dd = defn
603603 m.isDeprecated
604604 || m.is(Synthetic )
605- || sym.name.is(ContextFunctionParamName ) // a ubiquitous parameter
606- || sym.name.is(ContextBoundParamName ) && sym.info.typeSymbol.isMarkerTrait // a ubiquitous parameter
607605 || m.hasAnnotation(dd.UnusedAnnot ) // param of unused method
606+ || sym.name.is(ContextFunctionParamName ) // a ubiquitous parameter
607+ || sym.isCanEqual
608608 || sym.info.typeSymbol.match // more ubiquity
609609 case dd.DummyImplicitClass | dd.SubTypeClass | dd.SameTypeClass => true
610- case _ => false
610+ case tps =>
611+ tps.isMarkerTrait // no members to use; was only if sym.name.is(ContextBoundParamName)
612+ || // but consider NotGiven
613+ tps.hasAnnotation(dd.LanguageFeatureMetaAnnot )
611614 || sym.info.isSingleton // DSL friendly
612- || sym.isCanEqual
613- || sym.info.typeSymbol.hasAnnotation(dd.LanguageFeatureMetaAnnot )
614615 || sym.info.isInstanceOf [RefinedType ] // can't be expressed as a context bound
615616 if ctx.settings.WunusedHas .implicits
616617 && ! infos.skip(m)
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ trait T
1919object T :
2020 def hole (using T ) = ()
2121
22- class C (using T ) // warn
22+ class C (using T ) // no warn marker trait is evidence only
2323
2424class D (using T ):
2525 def t = T .hole // nowarn
@@ -53,7 +53,8 @@ object Unmatched:
5353 case _ =>
5454 e
5555
56- trait Ctx
56+ trait Ctx :
57+ val state : Int
5758case class K (i : Int )(using val ctx : Ctx ) // nowarn
5859class L (val i : Int )(using val ctx : Ctx ) // nowarn
5960class M (val i : Int )(using ctx : Ctx ) // warn
Original file line number Diff line number Diff line change 1+ //> using options -Werror -Wunused:all
2+ import scala .util .NotGiven
3+
4+ object Test {
5+ def f [T ](a : Int )(using NotGiven [T <:< Int ]) = a + 2
6+ }
7+
8+ trait Furthermore :
9+ type Intish [A ] = A <:< Int
10+ def f [A : Intish ] = ()
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ trait Anonymous {
9898}
9999trait Context [A ]
100100trait Implicits {
101- def f [A ](implicit ctx : Context [A ]) = answer // warn implicit param even though only marker
101+ def f [A ](implicit ctx : Context [A ]) = answer // no warn after all; previously, warn implicit param even though marker
102102 def g [A : Context ] = answer // no warn bound that is marker only
103103}
104104class Bound [A : Context ] // no warn bound that is marker only
You can’t perform that action at this time.
0 commit comments