Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,9 @@ trait Implicits:
def candSucceedsGiven(sym: Symbol): Boolean =
val owner = sym.owner
if owner == candSym.owner then
sym.is(GivenVal) && sym.span.exists && sym.span.start <= candSym.span.start
sym.is(GivenVal)
&& !sym.name.startsWith("derived$") // logically a synthetic injected at the end of the body
&& sym.span.exists && sym.span.start <= candSym.span.start
else if owner.isClass then false
else candSucceedsGiven(owner)

Expand Down
11 changes: 11 additions & 0 deletions tests/pos/i23897.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import scala.deriving.Mirror

class Test[A]
object Test:
def derived[A](using m: Mirror.Of[A], t: Test[Int]): Test[A] = new Test[A]

case class Foo(i: Int) derives Test
object Foo:
//given i: Test[Int] = new Test[Int]
given Test[Int]()
Loading