diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index 1f43c49057a2..409574736dde 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -926,7 +926,7 @@ object CheckUnused: def isCanEqual: Boolean = sym.isOneOf(GivenOrImplicit) && sym.info.finalResultType.baseClasses.exists(_.derivesFrom(defn.CanEqualClass)) def isMarkerTrait: Boolean = - sym.info.hiBound.allMembers.forall: d => + sym.info.hiBound.resultType.allMembers.forall: d => val m = d.symbol !m.isTerm || m.isSelfSym || m.is(Method) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass) def isEffectivelyPrivate: Boolean = diff --git a/tests/warn/i15503f.scala b/tests/warn/i15503f.scala index c2eef8a529c5..70d0b9182eb2 100644 --- a/tests/warn/i15503f.scala +++ b/tests/warn/i15503f.scala @@ -1,4 +1,4 @@ -//> using options -Wunused:implicits +//> using options -Wunused:implicits /* This goes around the "trivial method" detection */ val default_int = 1 @@ -67,6 +67,8 @@ package givens: trait Y: def doY: String + trait Z + given X: def doX = 7 @@ -84,6 +86,9 @@ package givens: given namely: (x: X) => Y: // warn protected param to given class def doY = "8" + + def f(using => X) = println() // warn + def g(using => Z) = println() // nowarn marker trait end givens object i22895: diff --git a/tests/warn/i23494.scala b/tests/warn/i23494.scala new file mode 100644 index 000000000000..c3c0c5a2e0bc --- /dev/null +++ b/tests/warn/i23494.scala @@ -0,0 +1,15 @@ +//> using options -Wunused:implicits + +import scala.deriving.Mirror + +abstract class EnumerationValues[A]: + type Out + +object EnumerationValues: + type Aux[A, B] = EnumerationValues[A] { type Out = B } + + def apply[A, B](): EnumerationValues.Aux[A, B] = new EnumerationValues[A]: + override type Out = B + + given sum[A, B <: Tuple](using mirror: Mirror.SumOf[A] { type MirroredElemTypes = B }): EnumerationValues.Aux[A, A] = + EnumerationValues[A, A]()