@@ -315,8 +315,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
315
315
loop(formal)
316
316
317
317
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) )
320
320
then report.error(
321
321
em " $name mismatch, expected: $expected, found: $actual. " , ctx.source.atSpan(span))
322
322
@@ -504,6 +504,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
504
504
case MirrorSource .Singleton (_, tref) =>
505
505
val singleton = tref.termSymbol // prefer alias name over the original name
506
506
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)
507
509
if tref.classSymbol.is(Scala2x ) then // could be Scala 3 alias of Scala 2 case object.
508
510
val mirrorType = formal.constrained_& {
509
511
mirrorCore(defn.Mirror_SingletonProxyClass , mirroredType, mirroredType, singleton.name)
0 commit comments