diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index af7d0c31d621..9304dd3f91b7 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -683,8 +683,8 @@ trait Implicits { self: Typer => case arg :: Nil if !arg.typeSymbol.is(Param) => object bindFreeVars extends TypeMap { var ok = true - def apply(t: Type) = t match { - case t @ TypeRef(NoPrefix, _) => + def apply(t: Type) = t.dealias match { + case t @ TypeRef(NoPrefix, _) if !ctx.inInlineMethod => inferImplicit(defn.QuotedTypeType.appliedTo(t), EmptyTree, span) match { case SearchSuccess(tag, _, _) if tag.tpe.isStable => tag.tpe.select(defn.QuotedType_splice) @@ -692,7 +692,7 @@ trait Implicits { self: Typer => ok = false t } - case _ => t + case tp => mapOver(tp) } } val tag = bindFreeVars(arg) diff --git a/tests/pos/i6588.scala b/tests/pos/i6588.scala new file mode 100644 index 000000000000..c9ad60584be2 --- /dev/null +++ b/tests/pos/i6588.scala @@ -0,0 +1,27 @@ +import scala.quoted._ + +inline def foo[T:Type]: Int = 10 + +def main = { + type S = Int + foo[S] + foo[Int] + + type T = Int => Int + foo[T] + foo[Int => Int] + + type U = List[Int] + foo[U] + foo[List[Int]] + + type N = List + foo[N] + foo[List] + + type V = List[S] + foo[V] + + type B = V => T + foo[B] +} diff --git a/tests/run-with-compiler/i4350.check b/tests/run-with-compiler/i4350.check index e670af3da233..5072214a8280 100644 --- a/tests/run-with-compiler/i4350.check +++ b/tests/run-with-compiler/i4350.check @@ -1,2 +1,2 @@ (null: scala.Any).asInstanceOf[java.lang.Object] -(null: scala.Any).asInstanceOf[scala.Predef.String] +(null: scala.Any).asInstanceOf[java.lang.String]