Skip to content

Commit 4447d41

Browse files
som-snytttgodzik
authored andcommitted
No warn implicit param of overriding method
1 parent 639b51a commit 4447d41

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/warn/i15503f.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,18 @@ package givens:
7575
given namely (using x: X): Y with // warn protected param to given class
7676
def doY = "8"
7777
end givens
78+
79+
object i22895:
80+
trait Test[F[_], Ev] {
81+
def apply[A, B](fa: F[A])(f: A => B)(using ev: Ev): F[B]
82+
}
83+
given testId: Test[[a] =>> a, Unit] =
84+
new Test[[a] =>> a, Unit] {
85+
def apply[A, B](fa: A)(f: A => B)(using ev: Unit): B = f(fa) // nowarn override
86+
}
87+
class C:
88+
def f(using s: String) = s.toInt
89+
class D(i: Int) extends C:
90+
override def f(using String) = compute(i) // nowarn override
91+
def g(using sss: String) = compute(i) // warn
92+
def compute(i: Int) = i * 42 // returning a class param is deemed trivial, make it non-trivial

0 commit comments

Comments
 (0)