diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index a79408b756ee..f1e6c1638463 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -1166,7 +1166,9 @@ object RefChecks { def targetOfHiddenExtension: Symbol = val target = val target0 = explicitInfo.firstParamTypes.head // required for extension method, the putative receiver - target0.dealiasKeepOpaques.typeSymbol.info + target0.dealiasKeepOpaques.typeSymbol.info match + case tb: AliasingBounds => tb.alias + case tp => tp val member = target.nonPrivateMember(sym.name) .filterWithPredicate: member => member.symbol.isPublic && memberHidesMethod(member) diff --git a/tests/pos/i23666.scala b/tests/pos/i23666.scala new file mode 100644 index 000000000000..197008b1776c --- /dev/null +++ b/tests/pos/i23666.scala @@ -0,0 +1,14 @@ + +type Tuple = scala.Tuple +type Any = scala.Any + +infix type =:= [A, B] = A => B + +object `=:=` : + given [A] => A =:= A = a => a + +extension [T <: Tuple] (tuple: T) + + def reverse[A, B](using ev: T =:= (A, B)): (B, A) = + val ab = ev(tuple) + (ab._2, ab._1)