File tree 4 files changed +20
-8
lines changed
compiler/src/dotty/tools/dotc/transform
4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -602,15 +602,16 @@ object CheckUnused:
602
602
val dd = defn
603
603
m.isDeprecated
604
604
|| m.is(Synthetic )
605
- || sym.name.is(ContextFunctionParamName ) // a ubiquitous parameter
606
- || sym.name.is(ContextBoundParamName ) && sym.info.typeSymbol.isMarkerTrait // a ubiquitous parameter
607
605
|| m.hasAnnotation(dd.UnusedAnnot ) // param of unused method
606
+ || sym.name.is(ContextFunctionParamName ) // a ubiquitous parameter
607
+ || sym.isCanEqual
608
608
|| sym.info.typeSymbol.match // more ubiquity
609
609
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 )
611
614
|| sym.info.isSingleton // DSL friendly
612
- || sym.isCanEqual
613
- || sym.info.typeSymbol.hasAnnotation(dd.LanguageFeatureMetaAnnot )
614
615
|| sym.info.isInstanceOf [RefinedType ] // can't be expressed as a context bound
615
616
if ctx.settings.WunusedHas .implicits
616
617
&& ! infos.skip(m)
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ trait T
19
19
object T :
20
20
def hole (using T ) = ()
21
21
22
- class C (using T ) // warn
22
+ class C (using T ) // no warn marker trait is evidence only
23
23
24
24
class D (using T ):
25
25
def t = T .hole // nowarn
@@ -53,7 +53,8 @@ object Unmatched:
53
53
case _ =>
54
54
e
55
55
56
- trait Ctx
56
+ trait Ctx :
57
+ val state : Int
57
58
case class K (i : Int )(using val ctx : Ctx ) // nowarn
58
59
class L (val i : Int )(using val ctx : Ctx ) // nowarn
59
60
class 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 {
98
98
}
99
99
trait Context [A ]
100
100
trait 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
102
102
def g [A : Context ] = answer // no warn bound that is marker only
103
103
}
104
104
class Bound [A : Context ] // no warn bound that is marker only
You can’t perform that action at this time.
0 commit comments