Skip to content

Commit 2b8dc2e

Browse files
committed
Remove redundant mapOver in fixThisTypeModuleClassReferences
We should only have mapOver in the default branch or on the returned type not both as that redundant and causes exponential growth in compilation time. fixes: #25362
1 parent 85b82a6 commit 2b8dc2e

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,11 @@ object Inlines:
607607
TreeTypeMap(
608608
typeMap = new TypeMap:
609609
override def stopAt = StopAt.Package
610-
def apply(t: Type) = mapOver {
610+
def apply(t: Type) =
611611
t match
612612
case ThisType(tref @ TypeRef(prefix, _)) if tref.symbol.flags.is(Module) && !owners.contains(tref.symbol) =>
613613
TermRef(apply(prefix), tref.symbol.companionModule)
614614
case _ => mapOver(t)
615-
}
616615
).typeMap(tpe)
617616

618617
if !hasOpaqueProxies && !hasOpaquesInResultFromCallWithTransparentContext then inlined

tests/pos/i25362/Macro_1.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package example
2+
import scala.deriving.Mirror
3+
import scala.quoted.*
4+
5+
class TC[A] {
6+
type Out
7+
}
8+
9+
object TC {
10+
transparent inline def derived[Left: Mirror.ProductOf as m]: TC[Left] =
11+
${ derivedImpl[Left, m.MirroredElemTypes] }
12+
13+
private def derivedImpl[Left: Type, LeftTypes: Type](using Quotes): Expr[TC[Left]] =
14+
'{ new TC[Left] { type Out = LeftTypes } }
15+
}

tests/pos/i25362/Test_2.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package example
2+
3+
opaque type BigTuple <: Repr = Repr
4+
final case class Repr(
5+
f1: Int, f2: Int, f3: Int, f4: Int, f5: Int,
6+
f6: Int, f7: Int, f8: Int, f9: Int, f10: Int,
7+
f11: Int, f12: Int, f13: Int, f14: Int, f15: Int,
8+
f16: Int, f17: Int, f18: Int, f19: Int, f20: Int,
9+
f21: Int, f22: Int, f23: Int, f24: Int, f25: Int,
10+
)
11+
12+
class test {
13+
val merger = TC.derived[BigTuple]
14+
}

0 commit comments

Comments
 (0)