Closed
Description
Compiler version
3.0.1
Minimized code
Here are two different errors in the same ticket since code to reproduce is almost the same and I suspect there is single bug.
trait TF[F[_]]
@main def main =
Tag[TF[Option]] // scala.MatchError: Type.of[...] (of class scala.quoted.runtime.impl.TypeImpl)
Tag[TF[_]] // java.lang.AssertionError: assertion failed: TypeBounds
object Tag:
import scala.quoted._
inline def apply[A]: Unit = ${impl[A]}
private def impl[A: Type](using Quotes): Expr[Unit] =
import quotes.reflect._
TypeRepr.of[A] match
case AppliedType(outer, inner) =>
'{
${Expr.ofList(inner.map(t0 => t0.asType match {
case '[t] => impl[t]
}))}
()
}
case t => ???
Output (click arrow to expand)
[error] 4 | Tag[TF[Option]]
[error] | ^^^^^^^^^^^^^^^
[error] |Exception occurred while executing macro expansion.
[error] |scala.MatchError: Type.of[...] (of class scala.quoted.runtime.impl.TypeImpl)
[error] | at Tag$.doImpl$$anonfun$2$$anonfun$1(Foo.scala:22)
[error] | at scala.collection.immutable.List.map(List.scala:246)
[error] | at Tag$.doImpl$$anonfun$3(Foo.scala:23)
[error] | at Tag$.doImpl$$anonfun$adapted$2(Foo.scala:23)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:82)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1367)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:97)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1335)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1437)
[error] | at scala.collection.immutable.List.mapConserve(List.scala:472)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1437)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1437)
[error] | at scala.collection.immutable.List.mapConserve(List.scala:472)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1437)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:122)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:61)
[error] | at scala.quoted.runtime.impl.QuotesImpl.unpickleExpr(QuotesImpl.scala:2913)
[error] | at Tag$.doImpl(Foo.scala:23)
[error] | at Tag$.impl(Foo.scala:13)
[error] | at Tag$.inline$impl(Foo.scala:12)
[error] |
[error] | This location contains code that was inlined from Bar.scala:4
Output2 (click arrow to expand)
[error] 5 | Tag[TF[_]]
[error] | ^^^^^^^^^^
[error] |Exception occurred while executing macro expansion.
[error] |java.lang.AssertionError: assertion failed: TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),HKTypeLambda(List(_$2), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any), List()))
[error] | at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] | at dotty.tools.dotc.core.Types$TypeBounds.<init>(Types.scala:4791)
[error] | at dotty.tools.dotc.core.Types$RealTypeBounds.<init>(Types.scala:4852)
[error] | at dotty.tools.dotc.core.Types$TypeBounds$.apply(Types.scala:4896)
[error] | at dotty.tools.dotc.core.Types$TypeBounds.derivedTypeBounds(Types.scala:4799)
[error] | at dotty.tools.dotc.core.ConstraintHandling.addOneBound(ConstraintHandling.scala:108)
[error] | at dotty.tools.dotc.core.ConstraintHandling.addOneBound$(ConstraintHandling.scala:26)
[error] | at dotty.tools.dotc.core.ProperGadtConstraint.addOneBound(GadtConstraint.scala:60)
[error] | at dotty.tools.dotc.core.ConstraintHandling.addBoundTransitively(ConstraintHandling.scala:162)
[error] | at dotty.tools.dotc.core.ConstraintHandling.addBoundTransitively$(ConstraintHandling.scala:26)
[error] | at dotty.tools.dotc.core.ProperGadtConstraint.addBoundTransitively(GadtConstraint.scala:60)
[error] | at dotty.tools.dotc.core.ProperGadtConstraint.addBound(GadtConstraint.scala:159)
[error] | at dotty.tools.dotc.core.TypeComparer.gadtAddLowerBound(TypeComparer.scala:118)
[error] | at dotty.tools.dotc.core.TypeComparer.narrowGADTBounds(TypeComparer.scala:1870)
[error] | at dotty.tools.dotc.core.TypeComparer.compareGADT$1(TypeComparer.scala:505)
[error] | at dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:508)
[error] | at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:557)
[error] | at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:488)
[error] | at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:297)
[error] | at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:303)
[error] | at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1282)
[error] | at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:185)
[error] | at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:195)
[error] | at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
[error] | at dotty.tools.dotc.core.TypeComparer$.topLevelSubType(TypeComparer.scala:2673)
[error] | at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:1032)
[error] | at scala.quoted.runtime.impl.QuoteMatcher$.$eq$qmark$eq(QuoteMatcher.scala:336)
[error] | at scala.quoted.runtime.impl.QuoteMatcher$.treeMatch(QuoteMatcher.scala:129)
[error] | at scala.quoted.runtime.impl.QuotesImpl.scala$quoted$runtime$impl$QuotesImpl$$treeMatch(QuotesImpl.scala:2961)
[error] | at scala.quoted.runtime.impl.QuotesImpl$TypeMatch$.unapply(QuotesImpl.scala:2931)
[error] | at Tag$.doImpl$$anonfun$2$$anonfun$1(Foo.scala:22)
[error] | at scala.collection.immutable.List.map(List.scala:246)
[error] | at Tag$.doImpl$$anonfun$3(Foo.scala:23)
[error] | at Tag$.doImpl$$anonfun$adapted$2(Foo.scala:23)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:82)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1367)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:97)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1335)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1437)
[error] | at scala.collection.immutable.List.mapConserve(List.scala:472)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1437)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1437)
[error] | at scala.collection.immutable.List.mapConserve(List.scala:472)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1437)
[error] | at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:107)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:122)
[error] | at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:61)
[error] | at scala.quoted.runtime.impl.QuotesImpl.unpickleExpr(QuotesImpl.scala:2913)
[error] | at Tag$.doImpl(Foo.scala:23)
[error] | at Tag$.impl(Foo.scala:13)
[error] | at Tag$.inline$impl(Foo.scala:12)
[error] |
[error] | This location contains code that was inlined from Bar.scala:5