@@ -315,8 +315,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
315315 loop(formal)
316316
317317 private def checkRefinement (formal : Type , name : TypeName , expected : Type , span : Span )(using Context ): Unit =
318- val actual = formal.lookupRefined (name)
319- if actual.exists && ! (expected =:= actual)
318+ val actual = formal.findMember (name, NoPrefix ).info
319+ if actual.exists && ! (actual.bounds.contains(expected) )
320320 then report.error(
321321 em " $name mismatch, expected: $expected, found: $actual. " , ctx.source.atSpan(span))
322322
@@ -504,6 +504,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
504504 case MirrorSource .Singleton (_, tref) =>
505505 val singleton = tref.termSymbol // prefer alias name over the original name
506506 val singletonPath = tpd.singleton(tref).withSpan(span)
507+ checkRefinement(formal, tpnme.MirroredElemTypes , defn.EmptyTupleModule .termRef, span)
508+ checkRefinement(formal, tpnme.MirroredElemLabels , defn.EmptyTupleModule .termRef, span)
507509 if tref.classSymbol.is(Scala2x ) then // could be Scala 3 alias of Scala 2 case object.
508510 val mirrorType = formal.constrained_& {
509511 mirrorCore(defn.Mirror_SingletonProxyClass , mirroredType, mirroredType, singleton.name)
0 commit comments