diff --git a/tests/pos/i17257.min.scala b/tests/pos/i17257.min.scala deleted file mode 100644 index f4e101cdbe21..000000000000 --- a/tests/pos/i17257.min.scala +++ /dev/null @@ -1,16 +0,0 @@ -//> using options -Yno-deep-subtypes:false -// Minimisation of tests/run-macros/i17257 -// to understand how changes to match type reduction -// impacted this use of Tuple.IsMappedBy. -// -// During match type reduction -// if we do NOT simplify the case lambda parameter instances -// then this large tuple make TypeComparer breach LogPendingSubTypesThreshold -// which, under -Yno-deep-subtypes, crashes the compilation. -class C[+A] -def foo[T <: Tuple : Tuple.IsMappedBy[C]] = ??? -def bar[X] = foo[( - C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], - C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], C[X], - C[X], C[X], C[X], -)] diff --git a/tests/run-macros/i17257/a.scala b/tests/run-macros/i17257/a.scala deleted file mode 100644 index 4a5682327604..000000000000 --- a/tests/run-macros/i17257/a.scala +++ /dev/null @@ -1,53 +0,0 @@ -package derivation -import scala.quoted.* - -import scala.annotation.tailrec - -object Helpers: - - // file a.scala - inline def summonAllOptimized[T <: Tuple]: T = - ${ summonAllOptimizedImpl[T] } - - inline def summon23[E]: (E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E) = - ${ summon23Impl[E] } - - private def summonAllOptimizedImpl[T <: Tuple: Type](using q: Quotes): Expr[T] = { - import q.reflect.* - - Expr - .ofTupleFromSeq(typesOfTuple(TypeRepr.of[T], Nil).map { tpe => - tpe.asType match { - case '[t] => - Expr.summon[t].getOrElse(report.errorAndAbort(s"Unable to to find implicit instance for ${tpe.show}")) - } - }) - .asExprOf[T] - } - - private def summon23Impl[E: Type](using q: Quotes): Expr[(E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E)] = { - import q.reflect.* - - val e = Expr.summon[E].getOrElse(report.errorAndAbort(s"Unable to to find implicit instance for ${TypeRepr.of[E].show}")) - - val tuple = (e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e) - - assert(tuple.size == 23) - - Expr.ofTuple(tuple) - } - - @tailrec - private[derivation] def typesOfTuple( - using q: Quotes - )(tpe: q.reflect.TypeRepr, acc: List[q.reflect.TypeRepr]): List[q.reflect.TypeRepr] = - import q.reflect.* - val cons = Symbol.classSymbol("scala.*:") - tpe.widenTermRefByName.dealias match - case AppliedType(fn, tpes) if defn.isTupleClass(fn.typeSymbol) => - tpes.reverse_:::(acc) - case AppliedType(tp, List(headType, tailType)) if tp.derivesFrom(cons) => - typesOfTuple(tailType, headType :: acc) - case tpe => - if tpe.derivesFrom(Symbol.classSymbol("scala.EmptyTuple")) then acc.reverse - else report.errorAndAbort(s"Unknown type encountered in tuple ${tpe.show}") diff --git a/tests/run-macros/i17257/b.scala b/tests/run-macros/i17257/b.scala deleted file mode 100644 index 65d66fb20bff..000000000000 --- a/tests/run-macros/i17257/b.scala +++ /dev/null @@ -1,23 +0,0 @@ -package derivation { - //file b.scala - val test = Helpers.summonAllOptimized[( - ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], - ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], - ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], - ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], ValueOf["a"], - ValueOf["a"], ValueOf["a"], ValueOf["a"] //Commenting out the last one here fixes the compile error - )] - val test2 = Helpers.summon23[ValueOf["a"]] -} -@main def Test = - def assertions(list: List[ValueOf["a"]]): Unit = - assert(list.size == 23) - assert(list.map(_.value) == List( - "a", "a", "a", "a", "a", - "a", "a", "a", "a", "a", - "a", "a", "a", "a", "a", - "a", "a", "a", "a", "a", - "a", "a", "a" - )) - assertions(derivation.test.toList) - assertions(derivation.test2.toList)