diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 4a5859363440..32c4a2eb3be9 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -509,7 +509,10 @@ trait ImplicitRunInfo { /** Is `sym` an anchor type for which givens may exist? Anchor types are classes, * opaque type aliases, and abstract types, but not type parameters */ - def isAnchor(sym: Symbol) = sym.isClass && !sym.is(Package) || sym.isOpaqueAlias + def isAnchor(sym: Symbol) = + sym.isClass && !sym.is(Package) + || sym.isOpaqueAlias + || sym.is(Deferred, butNot = Param) def anchors(tp: Type): List[Type] = tp match { case tp: NamedType if isAnchor(tp.symbol) => tp :: Nil diff --git a/tests/neg/quotedPatterns-4.scala b/tests/pos/quotedPatterns-4.scala similarity index 73% rename from tests/neg/quotedPatterns-4.scala rename to tests/pos/quotedPatterns-4.scala index 6321c9630e9b..96586928f2ff 100644 --- a/tests/neg/quotedPatterns-4.scala +++ b/tests/pos/quotedPatterns-4.scala @@ -3,7 +3,7 @@ object Test { def impl(receiver: Expr[StringContext])(using qctx: scala.quoted.QuoteContext) = { import qctx.tasty.Repeated receiver match { - case '{ StringContext(${Repeated(parts)}: _*) } => // error + case '{ StringContext(${Repeated(parts)}: _*) } => // now OK } } } diff --git a/tests/run/i8396.scala b/tests/run/i8396.scala new file mode 100644 index 000000000000..08c5e769e517 --- /dev/null +++ b/tests/run/i8396.scala @@ -0,0 +1,16 @@ +trait Show[A]: + def show(a: A): String = a.toString + +object Prefix: + type AbstractType + type UpperBoundedType <: String + type FullyBoundedType >: String <: String + + given A as Show[AbstractType] + given B as Show[UpperBoundedType] + given C as Show[FullyBoundedType] + +@main def Test = + summon[Show[Prefix.AbstractType]] + summon[Show[Prefix.UpperBoundedType]] + summon[Show[Prefix.FullyBoundedType]]