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 @@ -595,15 +595,16 @@ object CheckUnused:
595595 val dd = defn
596596 m.isDeprecated
597597 || m.is(Synthetic )
598- || sym.owner.name.isContextFunction // a ubiquitous parameter
599- || sym.name.is(ContextBoundParamName ) && sym.info.typeSymbol.isMarkerTrait // a ubiquitous parameter
600598 || m.hasAnnotation(dd.UnusedAnnot ) // param of unused method
599+ || sym.owner.name.isContextFunction // a ubiquitous parameter
600+ || sym.isCanEqual
601601 || sym.info.typeSymbol.match // more ubiquity
602602 case dd.DummyImplicitClass | dd.SubTypeClass | dd.SameTypeClass => true
603- case _ => false
603+ case tps =>
604+ tps.isMarkerTrait // no members to use; was only if sym.name.is(ContextBoundParamName)
605+ || // but consider NotGiven
606+ tps.hasAnnotation(dd.LanguageFeatureMetaAnnot )
604607 || sym.info.isSingleton // DSL friendly
605- || sym.isCanEqual
606- || sym.info.typeSymbol.hasAnnotation(dd.LanguageFeatureMetaAnnot )
607608 || sym.info.isInstanceOf [RefinedType ] // can't be expressed as a context bound
608609 if ctx.settings.WunusedHas .implicits
609610 && ! 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
@@ -44,7 +44,8 @@ object Unmatched:
4444 case _ =>
4545 e
4646
47- trait Ctx
47+ trait Ctx :
48+ val state : Int
4849case class K (i : Int )(using val ctx : Ctx ) // nowarn
4950class L (val i : Int )(using val ctx : Ctx ) // nowarn
5051class 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